threads / discuss / 25453

Why there is no pre-checkout hook?

Subject: Why there is no pre-checkout hook?

## tl;dr

3 messages between Oct 15, 2010 and Oct 15, 2010.

replies: 2people: 3as markdown or json

Jonathan Nieder· Oct 15, 2010, 08:30 UTC · re: Óscar Fuentes · lore

Re: Why there is no pre-checkout hook?

Ó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. :)
Junio C Hamano· Oct 15, 2010, 22:46 UTC · re: Jonathan Nieder · lore

Re: Why there is no pre-checkout hook?

Jonathan Nieder <jrnieder@gmail.com> writes:
Show 13 quoted lines
> Ó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.

← back to recent threads