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

Re: [PATCH] checkout: add 'pre-checkout' hook

From
Jeff King <peff@peff.net>
Date
Oct 14, 2009, 05:25 UTC
Message-ID
<20091014052527.GH31810@coredump.intra.peff.net>
In-Reply-To
<7vr5t6lfr0.fsf@alter.siamese.dyndns.org>
On Tue, Oct 13, 2009 at 10:13:39PM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> >  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'.
> > +This hook can prevent the checkout from proceeding by exiting with an
> > +error code.
> >  
> >  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
> >  ref of the new HEAD and the flag is always 1.
> >  
> > +This hook can be used to perform any clean-up deemed necessary before
> > +checking out the new branch/files.
> > +
> > +post-checkout
> > +-----------
> 
> This is not about your patch, but the patch text shows that our diff
> algorithm seems to have a room for improvement.  I expected to see a
> straight insersion of block of text, not touching anything in the original
> section on post-checkout hook.

I think it's right as-is. He changed the title of the section, made a few tweaks in the text to make it appropriate for "pre-checkout", and then made a new post-checkout section that says "This is just like pre-checkout". So most of the lines were left untouched. Short of our diff understanding the block-formatting of asciidoc, I think it's as good as we can get.

-Peff
Previous: Sam VilainNext: Bert Wesarg
Message 6 of 9 in “checkout: add 'pre-checkout' hook”
  1. checkout: add 'pre-checkout' hookSam Vilain, Oct 14, 2009
  2. Jeff KingOct 14, 2009
  3. Sam VilainOct 14, 2009
  4. Junio C HamanoOct 14, 2009
  5. Sam VilainOct 14, 2009
  6. Jeff KingOct 14, 2009
  7. Bert WesargOct 14, 2009
  8. Sam VilainOct 14, 2009
  9. Bert WesargOct 14, 2009

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.