[PATCH 2/3] t7001: use "ls-files --format" instead of "cut"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 t/t7001-mv.sh | 3 +--
 1 file changed, 1 insertion(+), 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' '
-- 
2.40.1.802.gdef2a8734a




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux