Re: merge hook

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

 



Hi,

On Fri, 10 Oct 2008, Erik Colson wrote:

> Is it possible to launch a custom script on all files involved in a 
> merge to master ? If yes, is it then also possible to reject the merge 
> if the script returns an error ?

>From Documentation/githooks.txt:

-- snip --
prepare-commit-msg
------------------

This hook is invoked by 'git-commit' right after preparing the
default log message, and before the editor is started.

It takes one to three parameters.  The first is the name of the file that 
the commit log message.  The second is the source of the commit message, 
and can be: [...] `merge` (if the commit is a merge or a `.git/MERGE_MSG` 
file exists); [...]

If the exit status is non-zero, 'git-commit' will abort.
-- snap --

To see which files are affected, you'd just need to ask "git diff 
--name-only --cached".

I guess that you want to disallow merging in changes from people who 
changed files that are none of their business?  If so, it would be nice to 
contribute the hook as a patch to contrib/.

Ciao,
Dscho

--
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]

  Powered by Linux