* Most reliable method to detect a merge commit in pre-commit hook
@ 2012-01-24 14:16 Sebastian Schuberth
2012-01-24 15:10 ` Stefan Haller
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Schuberth @ 2012-01-24 14:16 UTC (permalink / raw)
To: git
Hi,
I'd like our pre-commit hook to skip some checks if the commit that's
about to be made is a merge commit. What's the most reliable way to
detect a merge commit from within a pre-commit hook script? Currently,
the only way I see is to check whether .git/MERGE_MSG exists, but I'd
feel safer to check whether the commit is going to have more than one
parent or so. Is that possible / a better detection?
--
Sebastian Schuberth
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Most reliable method to detect a merge commit in pre-commit hook
2012-01-24 14:16 Most reliable method to detect a merge commit in pre-commit hook Sebastian Schuberth
@ 2012-01-24 15:10 ` Stefan Haller
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Haller @ 2012-01-24 15:10 UTC (permalink / raw)
To: Sebastian Schuberth, git
Sebastian Schuberth <sschuberth@gmail.com> wrote:
> I'd like our pre-commit hook to skip some checks if the commit that's
> about to be made is a merge commit. What's the most reliable way to
> detect a merge commit from within a pre-commit hook script? Currently,
> the only way I see is to check whether .git/MERGE_MSG exists, but I'd
> feel safer to check whether the commit is going to have more than one
> parent or so. Is that possible / a better detection?
I haven't found a better way either, so this is the method we use too.
The problem is that it fails when you are amending a merge commit; so
the output of our pre-commit hook advises the user to manually do a "git
commit --no-verify" in that case.
--
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-24 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24 14:16 Most reliable method to detect a merge commit in pre-commit hook Sebastian Schuberth
2012-01-24 15:10 ` Stefan Haller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).