{"thread":{"id":"26697","subject":"Re: [RFC/PATCH] merge: honor prepare-commit-msg hook","startedAt":"2011-03-09T00:16:34Z","lastAt":"2011-03-09T22:50:34Z","messageCount":2,"participants":["Jeffrey Middleton","Jay Soffian"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"163042","messageId":"AANLkTimqxNNJ7ezBYC8V_pW5=HB1md1xVrnKFV8sVBue@mail.gmail.com","threadId":"26697","inReplyTo":null,"subject":"Re: [RFC/PATCH] merge: honor prepare-commit-msg hook","fromName":"Jeffrey Middleton","fromEmail":"jefromi@gmail.com","sentAt":"2011-03-09T00:16:34Z","receivedAt":"2011-03-09T00:16:34Z","isPatch":true,"sender":{"key":"jefromi@gmail.com","avatar":null},"body":"I'd like to add a voice to the support for calling the\nprepare-commit-msg and post-commit hooks during a merge.\n\nReading the documentation, it seems like surely prepare-commit-msg\nwould be called: the description of the hook mentions that the second\nargument might be \"merge\". The sample hook (also mentioned there)\ntargets only merge commits, but happens to work because it's designed\nto only have an effect if there is a \"Conflicts:\" section, which\ntherefore means the user is committing manually. Another possible\nmerge-related use case for the hook would be intelligently rewriting\nthe subject, e.g. to canonicalize remote names in integration-style\nmerges.  If y'all don't agree, I'd suggest modifying the documentation\nto clarify that the hook is only called for manually-committed merges.\n\nMy instinct is that post-commit makes sense too - if you want to print\nsome extra information after a commit is recorded, why should it just\nbe non-merges?\n\n(and just in case, this is a reply to an old thread, including a\nproposed patch:\nhttp://thread.gmane.org/gmane.comp.version-control.git/151297/ )\n\nJeffrey\n\nJunio C Hamano <gitster <at> pobox.com> writes:\n> Jay Soffian <jaysoffian <at> gmail.com> writes:\n> > ---\n> > I couldn't figure out why my prepare-commit-msg wasn't being honored\n> > by git merge.\n>\n> It has been that way from day one, it appears.\n>\n> The bypassing of pre-commit hook was and remains to be a conscious design\n> decision.  When you are pulling from your contributors who may have\n> objectionable contents that you have to merge, the damage is already\n> done; you _could_ yell at them to fix their branch and re-pull in theory,\n> but that wouldn't work very well in practice.\n>\n> On the other hand, I think letting people use prepare-commit-msg for\n> merges might  make sense.  Indeed, \"git commit\" is prepared to call\n> prepare-commit-msg telling the hook that it is concluding a merge, when\n> your \"git merge\" stopped due to a conflict (or you stopped it from making\n> a new commit with --no-commit).\n>\n> I don't know about the other hooks \"git commit\" normally calls.  Both\n> \"commit-msg\" and \"post-commit\" may make sense, but I don't care too deeply\n> either way---I don't care too deeply for pre-commit either ;-).\n"},{"id":"163097","messageId":"AANLkTi=yxrLGEPQVG=knkZgXyeiAX+f_cF+mfJ3BYf+O@mail.gmail.com","threadId":"26697","inReplyTo":"AANLkTimqxNNJ7ezBYC8V_pW5=HB1md1xVrnKFV8sVBue@mail.gmail.com","subject":"Re: [RFC/PATCH] merge: honor prepare-commit-msg hook","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2011-03-09T22:50:34Z","receivedAt":"2011-03-09T22:50:34Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Mar 8, 2011 at 7:16 PM, Jeffrey Middleton <jefromi@gmail.com> wrote:\n> I'd like to add a voice to the support for calling the\n> prepare-commit-msg and post-commit hooks during a merge.\n\nSee 65969d4 (merge: honor prepare-commit-msg hook, 2011-02-14), now in\nmaster. I didn't do anything about the other hooks though.\n\nj.\n"}]}