Skip to content

Commit a9ea529

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b1c8ac3 commit a9ea529

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

t/t7001-mv.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ test_description='git mv in subdirs'
55
. "$TEST_DIRECTORY"/lib-diff-data.sh
66

77
index_at_path () {
8-
entry=$(git ls-files --stage "$@") &&
9-
echo "$entry" | cut -f 1
8+
git ls-files --format='%(objectmode) %(objectname) %(stage)' "$@"
109
}
1110

1211
test_expect_success 'mv -f refreshes updated index entry' '

0 commit comments

Comments
 (0)