git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Pelisse <apelisse@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git <git@vger.kernel.org>, Jay Soffian <jaysoffian@gmail.com>
Subject: Re: [PATCH] merge: Honor prepare-commit-msg return code
Date: Thu, 3 Jan 2013 18:33:29 +0100	[thread overview]
Message-ID: <CALWbr2zAWrGBSvMFOYMzhFnPejv6_uU3LH6dfOwimXs_1v1eMg@mail.gmail.com> (raw)
In-Reply-To: <7vwqvv1dta.fsf@alter.siamese.dyndns.org>

> Oh, that wasn't meant as a complaint.  I am tempted to rewrite the
> log message like so, though:
>
>     65969d4 (merge: honor prepare-commit-msg hook, 2011-02-14) tried to
>     make "git commit" and "git merge" consistent, because a merge that
>     required user assistance has to be concluded with "git commit", but
>     only "git commit" triggered prepare-commit-msg hook.  When it added
>     a call to run the prepare-commit-msg hook, however, it forgot to
>     check the exit code from the hook like "git commit" does, and ended
>     up replacing one inconsistency with another.

That's fine with me

>>> diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh
>>> index bc497bc..3573751 100755
>>> --- a/t/t7505-prepare-commit-msg-hook.sh
>>> +++ b/t/t7505-prepare-commit-msg-hook.sh
>>> @@ -172,11 +172,12 @@ test_expect_success 'with failing hook (merge)' '
>>>         git checkout -B other HEAD@{1} &&
>>>         echo "more" >> file &&
>>>         git add file &&
>>> -       chmod -x $HOOK &&
>>> +       rm -f "$HOOK" &&
>>>         git commit -m other &&
>>> -       chmod +x $HOOK &&
>>> +       write_script "$HOOK" <<-EOF
>>> +       exit 1
>>> +       EOF
>>>         git checkout - &&
>>> -       head=`git rev-parse HEAD` &&
>>>         test_must_fail git merge other
>>>
>>>  '
>>
>> What about moving the hook file then ? Not very important to me, just
>> a suggestion as it would keep the shebang.
>
> Strictly speaking, the way $HOOK is prepared in the original is
> wrong.  The script is always run under "#!/bin/sh" instead of the
> shell the user told us to use with $SHELL_PATH.  For a simple one
> liner that only exits with 1, it does not matter, though.
>
> Many test scripts got this wrong and that was the reason we later
> added write_script helper function to the test suite.

So let's keep your suggestion and squash the commit.

Thanks,

      reply	other threads:[~2013-01-03 17:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 18:42 [PATCH] merge: Honor prepare-commit-msg return code Antoine Pelisse
2013-01-02 19:05 ` Antoine Pelisse
2013-01-02 20:40 ` Junio C Hamano
2013-01-02 21:02   ` Antoine Pelisse
2013-01-02 21:21     ` Junio C Hamano
2013-01-03 17:33       ` Antoine Pelisse [this message]

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=CALWbr2zAWrGBSvMFOYMzhFnPejv6_uU3LH6dfOwimXs_1v1eMg@mail.gmail.com \
    --to=apelisse@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.com \
    /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).