git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Magne Land <magne.land@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Documentation/githooks: Clarify the behavior of post-checkout hook
Date: Tue, 13 Mar 2018 17:38:16 -0700	[thread overview]
Message-ID: <20180314003816.GE147135@aiede.svl.corp.google.com> (raw)
In-Reply-To: <0102016220f23987-d4661c81-cf6e-4c96-8487-acce6bb365c8-000000@eu-west-1.amazonses.com>

Hi,

Magne Land wrote:

> From: Magne Land <magne.land@appfolio.com>
>
> This can happen when using 'git rebase -i’:
> could not detach HEAD
>
> Based on discovering this Stack Overflow discussion:
> https://stackoverflow.com/questions/25561485/git-rebase-i-with-squash-cannot-detach-head
> ---
>  Documentation/githooks.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Thanks for investigating and writing this.

May we forge your sign-off?  See Documentation/SubmittingPatches
section [[sign-off] 'Certify your work' for more about what this
means.

The above leaves one question unanswered: is this the *right* behavior
for "git checkout" to have?  I.e. is it useful for "git checkout" to
fail when the post-checkout hook fails, or would it be better for it
to e.g. simply print a message and exit with status 0?

Not a rhetorical question: I'm asking because I don't know the answer.
What do you think?

Thanks,
Jonathan

> --- a/Documentation/githooks.txt
> +++ b/Documentation/githooks.txt
> @@ -166,7 +166,9 @@ worktree.  The hook is given three parameters: the ref of the previous HEAD,
>  the ref of the new HEAD (which may or may not have changed), and a flag
>  indicating whether the checkout was a branch checkout (changing branches,
>  flag=1) or a file checkout (retrieving a file from the index, flag=0).
> -This hook cannot affect the outcome of 'git checkout'.
> +
> +If this hook exits with a non-zero status, 'git checkout' will exit with the
> +same status.
>  
>  It is also run after 'git clone', unless the --no-checkout (-n) option is
>  used. The first parameter given to the hook is the null-ref, the second the

      reply	other threads:[~2018-03-14  0:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13 19:59 [PATCH] Documentation/githooks: Clarify the behavior of post-checkout hook Magne Land
2018-03-14  0:38 ` Jonathan Nieder [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20180314003816.GE147135@aiede.svl.corp.google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=magne.land@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).