Re: [RFC/PATCH] merge: honor prepare-commit-msg hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'd like to add a voice to the support for calling the
prepare-commit-msg and post-commit hooks during a merge.

Reading the documentation, it seems like surely prepare-commit-msg
would be called: the description of the hook mentions that the second
argument might be "merge". The sample hook (also mentioned there)
targets only merge commits, but happens to work because it's designed
to only have an effect if there is a "Conflicts:" section, which
therefore means the user is committing manually. Another possible
merge-related use case for the hook would be intelligently rewriting
the subject, e.g. to canonicalize remote names in integration-style
merges.  If y'all don't agree, I'd suggest modifying the documentation
to clarify that the hook is only called for manually-committed merges.

My instinct is that post-commit makes sense too - if you want to print
some extra information after a commit is recorded, why should it just
be non-merges?

(and just in case, this is a reply to an old thread, including a
proposed patch:
http://thread.gmane.org/gmane.comp.version-control.git/151297/ )

Jeffrey

Junio C Hamano <gitster <at> pobox.com> writes:
> Jay Soffian <jaysoffian <at> gmail.com> writes:
> > ---
> > I couldn't figure out why my prepare-commit-msg wasn't being honored
> > by git merge.
>
> It has been that way from day one, it appears.
>
> The bypassing of pre-commit hook was and remains to be a conscious design
> decision.  When you are pulling from your contributors who may have
> objectionable contents that you have to merge, the damage is already
> done; you _could_ yell at them to fix their branch and re-pull in theory,
> but that wouldn't work very well in practice.
>
> On the other hand, I think letting people use prepare-commit-msg for
> merges might  make sense.  Indeed, "git commit" is prepared to call
> prepare-commit-msg telling the hook that it is concluding a merge, when
> your "git merge" stopped due to a conflict (or you stopped it from making
> a new commit with --no-commit).
>
> I don't know about the other hooks "git commit" normally calls.  Both
> "commit-msg" and "post-commit" may make sense, but I don't care too deeply
> either way---I don't care too deeply for pre-commit either ;-).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]