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

Re: [PATCH 3/3] t7004, t7030: fix here-doc syntax errors

From
Santiago Torres <santiago@nyu.edu>
Date
Mar 22, 2017, 22:34 UTC
Message-ID
<20170322223441.w32y464jqbnxnzna@LykOS.localdomain>
In-Reply-To
<20170322222230.yqqv6x4gokvb4jbz@sigill.intra.peff.net>
Show 17 quoted lines
> I worked up the patch to do that (see below), but I got stumped trying
> to write the commit message. Perhaps that is what the test intended, but
> I don't think tag's --format understands "%G" codes at all. So you
> cannot tell from the output if a tag was valid or not; you have to check
> the exit code separately.
> 
> And if you do something like:
> 
>   git tag -v --format='%(tag)' foo bar |
>   while read tag
>   do
>      ...
>   done
> 
> you cannot tell at all which ones are bogus. Whereas with the current
> behavior, the bogus ones are quietly omitted. Which can also be
> confusing, but I'd think would generally err on the side of caution.

In that case, something like this would be closer to the desired behavior?

I'm also unsure on what would be the right thing to put on the commit message.

-Santiago.
---
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index b4698ab5f..70f6d4646 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -896,19 +896,18 @@ test_expect_success GPG 'verifying a forged tag should fail' '
 '
 
 test_expect_success 'verifying a proper tag with --format pass and format accordingly' '
-	cat >expect <<-\EOF
+	cat >expect <<-\EOF &&
 	tagname : signed-tag
-	EOF &&
+	EOF
 	git tag -v --format="tagname : %(tag)" "signed-tag" >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
-	cat >expect <<-\EOF
+test_expect_success 'verifying a forged tag with --format should fail silently' '
+	cat >expect <<-\EOF &&
 	tagname : forged-tag
-	EOF &&
-	test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag" >actual &&
-	test_cmp expect actual
+	EOF
+	test_must_fail git tag -v --format="tagname : %(tag)" "forged-tag"
 '
 
 # blank and empty messages for signed tags:
diff --git a/t/t7030-verify-tag.sh b/t/t7030-verify-tag.sh
index d62ccbb98..ba0aafa1f 100755
--- a/t/t7030-verify-tag.sh
+++ b/t/t7030-verify-tag.sh
@@ -126,19 +126,18 @@ test_expect_success GPG 'verify multiple tags' '
 '
 
 test_expect_success 'verifying tag with --format' '
-	cat >expect <<-\EOF
+	cat >expect <<-\EOF &&
 	tagname : fourth-signed
-	EOF &&
+	EOF
 	git verify-tag --format="tagname : %(tag)" "fourth-signed" >actual &&
 	test_cmp expect actual
 '
 
-test_expect_success 'verifying a forged tag with --format fail and format accordingly' '
-	cat >expect <<-\EOF
+test_expect_success 'verifying a forged tag with --format should fail silently' '
+	cat >expect <<-\EOF &&
 	tagname : 7th forged-signed
-	EOF &&
-	test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag) >actual-forged &&
-	test_cmp expect actual-forged
+	EOF
+	test_must_fail git verify-tag --format="tagname : %(tag)" $(cat forged1.tag)
 '
 
 test_done
Previous: Jeff KingNext: Jeff King
Message 28 of 46 in “EOF test fixes (t5615/t7004)”
  1. Jan PalusMar 22, 2017
  2. Jan PalusMar 22, 2017
  3. Stefan BellerMar 22, 2017
  4. Junio C HamanoMar 22, 2017
  5. 0/3 fix "here-doc" syntax errorsJunio C Hamano, Mar 22, 2017
  6. 1/3 t5615: fix a here-doc syntax errorJunio C Hamano, Mar 22, 2017
  7. Jeff KingMar 22, 2017
  8. 2/3 t7406: fix here-doc syntax errorsJunio C Hamano, Mar 22, 2017
  9. Jeff KingMar 22, 2017
  10. Stefan BellerMar 22, 2017
  11. Jeff KingMar 22, 2017
  12. t7406: correct test case for submodule-update initial populationStefan Beller, Mar 22, 2017
  13. Jeff KingMar 22, 2017
  14. Stefan BellerMar 22, 2017
  15. Jeff KingMar 22, 2017
  16. Jonathan NiederMar 22, 2017
  17. Junio C HamanoMar 22, 2017
  18. Jeff KingMar 22, 2017
  19. Stefan BellerMar 22, 2017
  20. Junio C HamanoMar 22, 2017
  21. 3/3 t7004, t7030: fix here-doc syntax errorsJunio C Hamano, Mar 22, 2017
  22. Jeff KingMar 22, 2017
  23. Santiago TorresMar 22, 2017
  24. Jeff KingMar 22, 2017
  25. Junio C HamanoMar 22, 2017
  26. Santiago TorresMar 22, 2017
  27. Jeff KingMar 22, 2017
  28. Santiago TorresMar 22, 2017
  29. Jeff KingMar 22, 2017
  30. Junio C HamanoMar 22, 2017
  31. Santiago TorresMar 22, 2017
  32. Junio C HamanoMar 23, 2017
  33. Santiago TorresMar 23, 2017
  34. Jeff KingMar 23, 2017
  35. Junio C HamanoMar 24, 2017
  36. Jeff KingMar 24, 2017
  37. Junio C HamanoMar 24, 2017
  38. Jeff KingMar 24, 2017
  39. Jeff KingMar 24, 2017
  40. Junio C HamanoMar 22, 2017
  41. Jan PalusMar 22, 2017
  42. tests: lint for run-away here-docJunio C Hamano, Mar 23, 2017
  43. Junio C HamanoMar 23, 2017
  44. Jonathan NiederMar 24, 2017
  45. Junio C HamanoMar 24, 2017
  46. Jeff KingMar 24, 2017

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.