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

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

From
Sam Vilain <sam.vilain@catalyst.net.nz>
Date
Oct 14, 2009, 05:25 UTC
Message-ID
<4AD560C8.8010108@catalyst.net.nz>
In-Reply-To
<20091014051319.GF31810@coredump.intra.peff.net>
Jeff King wrote:
Show 7 quoted lines
>> 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.
Right.  Yes, this could be explained more.

Actually the use case is submodules. When switching branches, the user wants to add a hook to remove submodules. However post-checkout is too late, because the index and the .gitmodules file do not record the submodule locations.

Of course the best explanation is a test case :) I'll look at cooking one up.

-- 
Sam Vilain, Perl Hacker, Catalyst IT (NZ) Ltd.
phone: +64 4 499 2267        PGP ID: 0x66B25843
Previous: Jeff KingNext: Junio C Hamano
Message 3 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.