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

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

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Oct 14, 2009, 06:49 UTC
Message-ID
<36ca99e90910132349o25322021l266124bd8b0d30b3@mail.gmail.com>
In-Reply-To
<1255495525-11254-1-git-send-email-sam.vilain@catalyst.net.nz>
On Wed, Oct 14, 2009 at 06:45, Sam Vilain <sam.vilain@catalyst.net.nz> wrote:
Show 14 quoted lines
> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
> index 06e0f31..8dc3fbf 100644
> --- a/Documentation/githooks.txt
> +++ b/Documentation/githooks.txt
> @@ -143,21 +143,31 @@ pre-rebase
>  This hook is called by 'git-rebase' and can be used to prevent a branch
>  from getting rebased.
>
> +pre-checkout
> +-----------
>
> -post-checkout
> -~~~~~~~~~~~~~
> -
Why do you change the caption from subsection (Ie. ~~~) to section (Ie. ---)?
Show 19 quoted lines
> -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
>  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
> +-----------
Ditto.
Show 8 quoted lines
> +
> +This hook is invoked when a 'git-checkout' is run after having updated the
> +worktree.  It takes the same arguments as the 'pre-checkout' hook.
> +This hook cannot affect the outcome of 'git-checkout'.
> +
>  This hook can be used to perform repository validity checks, auto-display
>  differences from the previous HEAD if different, or set working dir metadata
>  properties.
Bert
Previous: Jeff KingNext: Sam Vilain
Message 7 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.