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

Re: [PATCH v2] Fix git-tag test breakage caused by broken sed on Leopard

From
Wincent Colaiuta <win@wincent.com>
Date
Nov 16, 2007, 13:48 UTC
Message-ID
<03D3DFCD-B5F7-47CF-AFD2-F1408BB11AB3@wincent.com>
In-Reply-To
<7A6820DE-C6EE-4E3E-A97F-97766F682B85@wincent.com>
El 16/11/2007, a las 14:45, Wincent Colaiuta escribió:
Show 26 quoted lines
> El 16/11/2007, a las 6:14, Junio C Hamano escribió:
>
>> Wincent Colaiuta <win@wincent.com> writes:
>>
>>> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
>>> index 096fe33..b54c2e0 100755
>>> --- a/t/t7004-tag.sh
>>> +++ b/t/t7004-tag.sh
>>> @@ -1007,7 +1007,7 @@ test_expect_failure \
>>> test_expect_success \
>>> 	'message in editor has initial comment' '
>>> 	GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
>>> -	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
>>> +	test $(grep -e "^#" -e "^\$" actual | wc -l ) -gt 0
>>> '
>>
>> Heh, doesn't grep exit with zero only when it found some lines
>> that match the pattern already?  What's that "wc -l" for?
>
>
> I was just trying to make the minimal change (swapping grep for  
> sed), but if you want a shorter version then we don't even need the  
> "test"; it could just be:
>
> -	test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0
> +	grep -e "^#" -e "^\$" actual

Although I don't know if we should be testing for empty lines there because an 0-byte empty "actual" file would spuriously pass the test. Perhaps this would be better:

- test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0 + grep -e "^#" actual

Cheers, Wincent

Previous: Wincent ColaiutaNext: Mike Hommey
Message 8 of 26 in “[BUG] t7004 (master) busted on Leopard”
  1. Wincent ColaiutaNov 15, 2007
  2. Johannes SchindelinNov 15, 2007
  3. David KastrupNov 15, 2007
  4. Wincent ColaiutaNov 15, 2007
  5. Fix git-tag test breakage caused by broken sed on LeopardWincent Colaiuta, Nov 15, 2007
  6. Fix git-tag test breakage caused by broken sed on LeopardWincent Colaiuta, Nov 15, 2007
  7. Wincent ColaiutaNov 16, 2007
  8. Wincent ColaiutaNov 16, 2007
  9. Mike HommeyNov 16, 2007
  10. Wincent ColaiutaNov 16, 2007
  11. Fix t7004 which fails with retarded sedMike Hommey, Nov 16, 2007
  12. Benoit SigoureNov 16, 2007
  13. Mike HommeyNov 16, 2007
  14. Wincent ColaiutaNov 16, 2007
  15. Junio C HamanoNov 16, 2007
  16. Mike HommeyNov 16, 2007
  17. Junio C HamanoNov 16, 2007
  18. Fix and improve t7004Mike Hommey, Nov 16, 2007
  19. Benoit SigoureNov 16, 2007
  20. Mike HommeyNov 16, 2007
  21. Benoit SigoureNov 16, 2007
  22. Mike HommeyNov 16, 2007
  23. Benoit SigoureNov 16, 2007
  24. Junio C HamanoNov 16, 2007
  25. Fix and improve t7004Mike Hommey, Nov 16, 2007
  26. Junio C HamanoNov 17, 2007

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.