{"thread":{"id":"27944","subject":"Why isn't there a hook for all operations that update the working tree?","startedAt":"2011-07-28T11:59:30Z","lastAt":"2011-08-04T02:06:26Z","messageCount":3,"participants":["Ævar Arnfjörð Bjarmason","Neal Kreitzinger","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"172257","messageId":"CACBZZX7dJhGT0H8JZRbQ_t9mNnJocaktYAXgMSihfLBuFmL3nw@mail.gmail.com","threadId":"27944","inReplyTo":null,"subject":"Why isn't there a hook for all operations that update the working tree?","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-07-28T11:59:30Z","receivedAt":"2011-07-28T11:59:30Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"I have a repository where I'd like to run a program every time the\nworking tree is updated. githooks(5) specifies that you can use\npost-{checkout,merge} hooks to hook into those two operations.\n\nHowever that doesn't catch e.g. \"git reset --hard\". Is there any\nreason beside omission that there isn't a post-reset hook? Or hooks\nfor any other thing (most of which surely slip my mind) which can\nupdate the working tree?\n"},{"id":"172836","messageId":"4E39FC55.206@gmail.com","threadId":"27944","inReplyTo":"CACBZZX7dJhGT0H8JZRbQ_t9mNnJocaktYAXgMSihfLBuFmL3nw@mail.gmail.com","subject":"Re: Why isn't there a hook for all operations that update the working tree?","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2011-08-04T01:56:37Z","receivedAt":"2011-08-04T01:56:37Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 7/28/2011 6:59 AM, Ævar Arnfjörð Bjarmason wrote:\n> I have a repository where I'd like to run a program every time the\n> working tree is updated. githooks(5) specifies that you can use\n> post-{checkout,merge} hooks to hook into those two operations.\n>\n> However that doesn't catch e.g. \"git reset --hard\". Is there any\n> reason beside omission that there isn't a post-reset hook? Or hooks\n> for any other thing (most of which surely slip my mind) which can\n> update the working tree?\n\nYou could create an alias like \"git resetr\" that runs the script.\n\nv/r,\nneal\n"},{"id":"172839","messageId":"7v1ux26icd.fsf@alter.siamese.dyndns.org","threadId":"27944","inReplyTo":"CACBZZX7dJhGT0H8JZRbQ_t9mNnJocaktYAXgMSihfLBuFmL3nw@mail.gmail.com","subject":"Re: Why isn't there a hook for all operations that update the working tree?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-04T02:06:26Z","receivedAt":"2011-08-04T02:06:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> ... Is there any\n> reason beside omission that there isn't a post-reset hook?\n> Or hooks for any other thing ...\n\nIn principle, we historically tended to avoid hooks unless absolutely\nnecessary. Even having to check to find out no hook needs to be run is\nconsidered wasted cycles.\n\n  http://thread.gmane.org/gmane.comp.version-control.git/79314/focus=79321\n\nI'd especially rather not to see a hook on something as low level as\n\"reset\". It would be too tempting to use \"reset\" itself inside a hook that\nis run from the post-reset hook, and I do not want to complicate the code\neven further to give callers to ask disabling the hook.\n"}]}