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

Re: [PATCH] Fix and improve t7004

From
Mike Hommey <mh@glandium.org>
Date
Nov 16, 2007, 21:11 UTC
Message-ID
<20071116211148.GA28966@glandium.org>
In-Reply-To
<EEE710FA-0408-489F-8128-B4C1F06D34FF@lrde.epita.fr>
On Fri, Nov 16, 2007 at 10:04:57PM +0100, Benoit Sigoure wrote:
Show 45 quoted lines
> On Nov 16, 2007, at 9:28 PM, Mike Hommey wrote:
>
>> Brown paper bag fix to avoid using non portable sed syntax. The
>> test by itself didn't catch what it was supposed to, anyways.
>>
>> The new test first checks whether the user exited the editor
>> without editing the file, then whether what the user was
>> presented in the editor was any useful to her, which we define
>> as the following:
>>  * It begins with a single blank line, where the invoked editor
>>    would typically place the editing curser at so that the user
>>    can immediately start typing;
>>
>>  * It has some instruction but that comes after that initial
>>    blank line, all lines prefixed with "#".
>>
>>  * And it has nothing else, as the expected behaviour is "Hey
>>    you did not leave any message".
>>
>> Signed-off-by: Mike Hommey <mh@glandium.org>
>> ---
>>  t/t7004-tag.sh |    9 ++++++++-
>>  1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
>> index 096fe33..42b1f97 100755
>> --- a/t/t7004-tag.sh
>> +++ b/t/t7004-tag.sh
>> @@ -1004,10 +1004,17 @@ test_expect_failure \
>>  	'verify signed tag fails when public key is not present' \
>>  	'git-tag -v signed-tag'
>>
>> +test_expect_failure \
>> +	'git-tag -a fails if tag annotation is empty' '
>> +	GIT_EDITOR=cat git tag -a initial-comment > /dev/null 2>&1
>> +'
>> +
>>  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
>> +	( read empty ;
>> +	  [ "$empty" ] && exit 1 ;
>
> What is this meant to do?  Did you mean [ -n "$empty" ] ?

Replacing with [ -n "$empty" ] would not work properly, except if you replace the following ; with &&. Does that really make a readability difference ?

Show 10 quoted lines
>> +	  ! grep -ve "^#" > /dev/null 2>&1 ) < actual
>
> The double negation is harder to read.  May I suggest something along these 
> lines (which seems more readable to me):
>   while read line; do
>     case $line in #(
>       '#'*) ;; # Accept comments (
>       *) exit 1;;
>     esac
>   done
I'm not really convinced. What do other people have to say ?
Mike
Previous: Benoit SigoureNext: Benoit Sigoure
Message 20 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.