Subject: Re: Why there is no pre-checkout hook?

From: Junio C Hamano <[email-masked]>
Date: Fri, 15 Oct 2010 15:46:44 -0700

Jonathan Nieder <[email-masked]> writes:

> Óscar Fuentes wrote:
>
>> [Subject: Why there is no pre-checkout hook?]
>
> Because you can use your script in place of "git checkout".
>
> Or: because no one's come up with a compelling use case for
> one.
>
> Or: because no one implemented it and demonstrated how to
> use it yet.
>
> Take your pick. :)

The first one is the most correct answer from historical standpoint for
almost any command, as git was designed to be scripted, and if you need
pre-frotz to always run before running frotz you should be doing that
before running frotz yoruself.  The same for post-frotz that would
unconditionally run after you run frotz.

Google/Bing/Gmane Search for "five valid reasons for git hook" ;-)

Having said that, I think it may be a good time to start thinking about
loosening the criteria, especially unconditional pre- and post- ones,
around Porcelain commands.  The "five valid reasons" criteria apply to
plumbing where you have more control and freedom and we do not want to
spend extra cycles even to check for non-existence of hooks.