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

Re: post-checkout hook aborts rebase

From
Elijah Newren <newren@gmail.com>
Date
Aug 27, 2020, 20:11 UTC
Message-ID
<CABPp-BEEmqdt2_OuNQFxyf6pkppBWptkcvuAYhWX8r+_Wr8-2g@mail.gmail.com>
In-Reply-To
<CAPx1GvfXOMFDsXE74LiG_BG5Bqb+seHDWX69xGe49C240ORi6A@mail.gmail.com>
On Thu, Aug 27, 2020 at 12:07 PM Chris Torek <chris.torek@gmail.com> wrote:
Show 8 quoted lines
>
> On Thu, Aug 27, 2020 at 8:51 AM Junio C Hamano <gitster@pobox.com> wrote:
> > I still suspect that the checkout run, merely as an implementation
> > detail of rebase (or any other git subcommand), should not trigger
> > any hook ...
>
> The *last* checkout from the finished rebase perhaps *should*, but
> other than that one, that seems logically correct.

What do you mean by the "last checkout"? I believe a typical non-interactive rebase of N patches has only one checkout, and I don't see why running hooks for the starting point is relevant.

If hooks are wanted for rebase, I'd still want to have rebase-specific ones, because most people who think of "checkout hooks" or "commit hooks" probably aren't going to think of them the way rebase or cherry-pick happen to use them. (And that might even be more true for --interactive and --rebase-merges cases.)

Show 26 quoted lines
> > but before any such code change, at least let's update the
> > documentation to clarify what we mean by "the outcome".
> >
> > Hopefully something like the below may be a good starting point?
> >
> >  Documentation/githooks.txt | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
> > index 31b601e4bc..cf95d6d02b 100644
> > --- a/Documentation/githooks.txt
> > +++ b/Documentation/githooks.txt
> > @@ -193,7 +193,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 switch` or `git checkout`.
> > +This hook cannot affect the outcome of `git switch` or `git checkout`,
> > +other than that the hook's exit status becomes the exit status of
> > +these two commands.
> >
> >  It is also run after linkgit:git-clone[1], unless the `--no-checkout` (`-n`) option is
> >  used. The first parameter given to the hook is the null-ref, the second the
>
> This looks good to me, and can either be independent of, or the first part of,
> any rebase update.
Patch looks good to me too.
Previous: Chris TorekNext: Chris Torek
Message 8 of 16 in “post-checkout hook aborts rebase”
  1. Tom RutherfordAug 26, 2020
  2. Junio C HamanoAug 27, 2020
  3. Junio C HamanoAug 27, 2020
  4. Tom RutherfordAug 27, 2020
  5. Chris TorekAug 27, 2020
  6. Junio C HamanoAug 27, 2020
  7. Chris TorekAug 27, 2020
  8. Elijah NewrenAug 27, 2020
  9. Chris TorekAug 27, 2020
  10. Phillip WoodSep 9, 2020
  11. Tom RutherfordSep 9, 2020
  12. Philippe BlainSep 11, 2020
  13. Junio C HamanoSep 12, 2020
  14. Elijah NewrenAug 27, 2020
  15. Junio C HamanoAug 27, 2020
  16. Elijah NewrenAug 27, 2020

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.