Re: [PATCH 1/2] t3101: test more ls-tree options

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

 



Thanks.  I'd squash this patch in for the following reasons; Ok?

 - The --abbrev=n option only guarantees that at least n hexdigits are
   used but the implementation is allowed to use more to avoid
   ambiguities.

 - The point of test_output function is that it does its own filtering
   before comparison; it is misleading to feed it if the caller munges the
   input.

 - Redirection should be immediately followed by filename; this is just a
   matter of personal taste, but being consistent in the new code is
   better than resulting in blocks of lines with mixed styles (no, I won't
   welcome a patch to fix the existing "cmd > file", unless it is done as
   part of a patch aka "while at it" that fixes something of substance
   nearby at the same time).

 t/t3101-ls-tree-dirname.sh |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh
index 99458e4..6ef371a 100755
--- a/t/t3101-ls-tree-dirname.sh
+++ b/t/t3101-ls-tree-dirname.sh
@@ -39,8 +39,8 @@ test_expect_success \
      tree=`git write-tree` &&
      echo $tree'
 
-_x5='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
-_x40="$_x5$_x5$_x5$_x5$_x5$_x5$_x5$_x5"
+_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
 test_output () {
     sed -e "s/ $_x40	/ X	/" <current >check
     test_cmp expected check
@@ -145,7 +145,7 @@ test_expect_success 'ls-tree --full-name' '
 	(
 		cd path0 &&
 		git ls-tree --full-name $tree a
-	) > current &&
+	) >current &&
 	cat >expected <<\EOF &&
 040000 tree X	path0/a
 EOF
@@ -156,7 +156,7 @@ test_expect_success 'ls-tree --full-tree' '
 	(
 		cd path1/b/c &&
 		git ls-tree --full-tree $tree
-	) > current &&
+	) >current &&
 	cat >expected <<\EOF &&
 100644 blob X	1.txt
 100644 blob X	2.txt
@@ -172,7 +172,7 @@ test_expect_success 'ls-tree --full-tree -r' '
 	(
 		cd path3/ &&
 		git ls-tree --full-tree -r $tree
-	) > current &&
+	) >current &&
 	cat >expected <<\EOF &&
 100644 blob X	1.txt
 100644 blob X	2.txt
@@ -186,8 +186,8 @@ EOF
 '
 
 test_expect_success 'ls-tree --abbrev=5' '
-	git ls-tree --abbrev=5 $tree > current.abbrev &&
-	sed -e "s/ $_x5	/ X	/"  < current.abbrev > current &&
+	git ls-tree --abbrev=5 $tree >current &&
+	sed -e "s/ $_x05[0-9a-f]*	/ X	/" <current >check &&
 	cat >expected <<\EOF &&
 100644 blob X	1.txt
 100644 blob X	2.txt
@@ -196,11 +196,11 @@ test_expect_success 'ls-tree --abbrev=5' '
 040000 tree X	path2
 040000 tree X	path3
 EOF
-	test_output
+	test_cmp expected check
 '
 
 test_expect_success 'ls-tree --name-only' '
-	git ls-tree --name-only $tree > current
+	git ls-tree --name-only $tree >current
 	cat >expected <<\EOF &&
 1.txt
 2.txt
@@ -213,7 +213,7 @@ EOF
 '
 
 test_expect_success 'ls-tree --name-only -r' '
-	git ls-tree --name-only -r $tree > current
+	git ls-tree --name-only -r $tree >current
 	cat >expected <<\EOF &&
 1.txt
 2.txt
-- 
1.6.5.3.283.g4b054

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]