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>
maint
Jeff King 2023-05-08 15:01:46 -04:00 committed by Junio C Hamano
parent b1c8ac3996
commit a9ea5296b7
1 changed files with 1 additions and 2 deletions

View File

@ -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' '