git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Hommey <mh@glandium.org>
To: Benoit Sigoure <tsuna@lrde.epita.fr>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] Fix and improve t7004
Date: Fri, 16 Nov 2007 22:11:48 +0100	[thread overview]
Message-ID: <20071116211148.GA28966@glandium.org> (raw)
In-Reply-To: <EEE710FA-0408-489F-8128-B4C1F06D34FF@lrde.epita.fr>

On Fri, Nov 16, 2007 at 10:04:57PM +0100, Benoit Sigoure wrote:
> 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 ?

>> +	  ! 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

  reply	other threads:[~2007-11-16 21:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-15 13:38 [BUG] t7004 (master) busted on Leopard Wincent Colaiuta
2007-11-15 14:37 ` Johannes Schindelin
2007-11-15 14:48   ` David Kastrup
2007-11-15 15:12   ` Wincent Colaiuta
2007-11-15 15:16   ` [PATCH] Fix git-tag test breakage caused by broken sed " Wincent Colaiuta
2007-11-15 15:47     ` [PATCH v2] " Wincent Colaiuta
     [not found]       ` <7v4pfm3h6f.fsf@gitster.siamese.dyndns.org>
2007-11-16 13:45         ` Wincent Colaiuta
2007-11-16 13:48           ` Wincent Colaiuta
2007-11-16 16:59             ` Mike Hommey
2007-11-16 17:25               ` Wincent Colaiuta
2007-11-16 17:26               ` [PATCH] Fix t7004 which fails with retarded sed Mike Hommey
2007-11-16 17:58                 ` Benoit Sigoure
2007-11-16 19:15                   ` Mike Hommey
2007-11-16 18:02                 ` Wincent Colaiuta
2007-11-16 18:26                 ` Junio C Hamano
2007-11-16 19:17                   ` Mike Hommey
2007-11-16 19:36                     ` Junio C Hamano
2007-11-16 20:28                       ` [PATCH] Fix and improve t7004 Mike Hommey
2007-11-16 21:04                         ` Benoit Sigoure
2007-11-16 21:11                           ` Mike Hommey [this message]
2007-11-16 21:31                             ` Benoit Sigoure
2007-11-16 21:35                               ` Mike Hommey
2007-11-16 21:47                                 ` Benoit Sigoure
2007-11-16 21:42                             ` Junio C Hamano
2007-11-16 22:02                               ` Mike Hommey
2007-11-17  8:55                                 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071116211148.GA28966@glandium.org \
    --to=mh@glandium.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tsuna@lrde.epita.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).