summaryrefslogtreecommitdiffstats
path: root/t/t7001-mv.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-05-08 21:01:46 +0200
committerJunio C Hamano <gitster@pobox.com>2023-05-08 23:50:28 +0200
commita9ea5296b772b795be1be112e98ff02c95cbe639 (patch)
tree099715f7ed487eab03a19764d2e0d5199132d712 /t/t7001-mv.sh
parentt7001: avoid git on upstream of pipe (diff)
downloadgit-a9ea5296b772b795be1be112e98ff02c95cbe639.tar.xz
git-a9ea5296b772b795be1be112e98ff02c95cbe639.zip
t7001: use "ls-files --format" instead of "cut"
Since ls-files recently learned a "--format" option, we can use that rather than asking for all of "--stage" and then pulling out the bits we want with "cut". That's simpler and avoids two extra processes (one for cut, and one for the subshell to hold the intermediate result). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7001-mv.sh')
-rwxr-xr-xt/t7001-mv.sh3
1 files changed, 1 insertions, 2 deletions
diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh
index ea70419928..2e6a3c0a54 100755
--- a/t/t7001-mv.sh
+++ b/t/t7001-mv.sh
@@ -5,8 +5,7 @@ test_description='git mv in subdirs'
. "$TEST_DIRECTORY"/lib-diff-data.sh
index_at_path () {
- entry=$(git ls-files --stage "$@") &&
- echo "$entry" | cut -f 1
+ git ls-files --format='%(objectmode) %(objectname) %(stage)' "$@"
}
test_expect_success 'mv -f refreshes updated index entry' '