Re: Has anyone written a hook to block fast forward merges to a branch?

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

 



On Wed, Mar 21, 2012 at 02:22:46PM -0400, Chris Patti wrote:

> I know there are hooks out there to block various other kinds of
> change, but I was wondering if anyone had specifically ever written
> one to block fast forward merges.

How would you detect them? If I do a fast-forward merge, the result is
indistinguishable from simply building the commits directly on the
branch in the first place.

If you mean "nobody should ever build commits directly on master, but
always be merging in commits from topic branches", then that is easier
to enforce; just look for non-merge commits down the --first-parent
line, and reject if you find any. I think you could do it with:

  git rev-list --max-parents=1 --first-parent $OLD..$NEW

If that produces output, then somebody build directly on master (or did
a backwards master->topic merge, but if you care about first-parents
lineage, then that is equally bad).

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