Re: [PATCH] checkout: add 'pre-checkout' hook
- From
Jeff King <peff@peff.net>
- Date
- Oct 14, 2009, 05:13 UTC
- Message-ID
- <20091014051319.GF31810@coredump.intra.peff.net>
- In-Reply-To
- <1255495525-11254-1-git-send-email-sam.vilain@catalyst.net.nz>
On Wed, Oct 14, 2009 at 05:45:25PM +1300, Sam Vilain wrote:
> Add a simple hook that will run before checkouts.
What is the use case that makes it useful as a hook, and not simply as something people can do before running checkout?
I guess you can use it to block a checkout, but only after finding out _what_ you are going to checkout, but an exact use case escapes me.
Show 5 quoted lines
> -post-checkout > -~~~~~~~~~~~~~ > - > -This hook is invoked when a 'git-checkout' is run after having updated the > +This hook is invoked when a 'git-checkout' is run after before updating the
Did you mean "before having" here?
Show 11 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.
Should this "after" in the bottom paragraph perhaps become "during"?
-Peff