From: Junio C Hamano <gitster@pobox.com>
To: Mike Hommey <mh@glandium.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix t7004 which fails with retarded sed
Date: Fri, 16 Nov 2007 10:26:58 -0800 [thread overview]
Message-ID: <7vpryaxczx.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1195233971-12288-1-git-send-email-mh@glandium.org> (Mike Hommey's message of "Fri, 16 Nov 2007 18:26:11 +0100")
Mike Hommey <mh@glandium.org> writes:
> Brown paper bag fix to avoid test failure with retarded sed. The test
> by itself didn't catch what it was supposed to, anyways.
I'd rather not to say "retarded sed". It is not fair to blame
the implementation when the script we feed to it is not
portable.
> 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
> + grep -e "^$" actual > /dev/null 2>&1 &&
> + grep -e "^#" actual > /dev/null 2>&1 &&
> + ! grep -e "^[^#]" actual > /dev/null 2>&1
The test simulates a case where
$ git tag -a initial-comment
is run and the user exits the editor without editing the file to
add any text to annotate the tag. The behaviour we want from
such an invocation is (1) the user sees a sensible template in
the editor, and (2) the command to error out, saying "Hey, you
did not leave any message for us to use".
So the earlier part of the test
GIT_EDITOR=cat git tag -a initial-comment > actual || true &&
is already bogus with respect to the latter point. It will
happily continue if "git tag" erroneously returns success, and
the above does not catch it.
if GIT_EDITOR=cat git tag -a initial-comment >actual
then
echo >&2 oops we should have errored out
false
else
: happy -- anything else we want to check?
fi
The "actual" file contains what the user saw in the editor and
returned to the "git tag" command.
The template we give to the user begins with a blank line,
followed by a brief instruction "write a tag message" as
comments to be stripped. The test is trying to make sure that
is what was given to the user. As you already discussed in the
thread, the exact wording may change in the future and we would
not want to adjust the test every time.
I think the important points about this template are:
* 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 "#". I do not think we
would want to check the wording of this instruction.
* And it has nothing else, as the expected behaviour is "Hey
you did not leave any message".
next prev parent reply other threads:[~2007-11-16 18:27 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 [this message]
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
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=7vpryaxczx.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mh@glandium.org \
/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).