git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 17, 2009, 06:21 UTC
Message-ID
<7vws1piscw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1258173248-31059-2-git-send-email-bebarino@gmail.com>
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
Previous: Stephen BoydNext: Stephen Boyd
Message 3 of 10 in “Migrate ls-tree to parse-opts”
  1. 0/2 Migrate ls-tree to parse-optsStephen Boyd, Nov 14, 2009
  2. 1/2 t3101: test more ls-tree optionsStephen Boyd, Nov 14, 2009
  3. Junio C HamanoNov 17, 2009
  4. Stephen BoydNov 17, 2009
  5. 2/2 ls-tree: migrate to parse-optionsStephen Boyd, Nov 14, 2009
  6. Junio C HamanoNov 17, 2009
  7. Stephen BoydNov 17, 2009
  8. Stephen BoydNov 17, 2009
  9. Junio C HamanoNov 18, 2009
  10. Thiago FarinaNov 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.