savannah-hackers-public
[Top][All Lists]
Advanced

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

Re: [Savannah-hackers-public] Re: prevent merge commits?


From: Jim Meyering
Subject: Re: [Savannah-hackers-public] Re: prevent merge commits?
Date: Sat, 08 Aug 2009 14:44:28 +0200

Sylvain Beucler wrote:
> Notifying the list is fine, but documenting is better :)
> Within 2 months this will be lost in oblivion^Warchives.

Ok.

I added this script: git/install-merge-prohibiting-push-hook

#!/bin/bash
# Install an "update" hook that does two things:
# - prohibit push of merge commit to "master"
# - prohibit push of any commit that adds "bad" whitespace

ME=$(basename "$0")
warn() { printf '%s: %s\n' "$ME" "$*" >&2; }

fail=0
for proj in "$@"; do
  dir=/vservers/vcs-noshell/srv/git/$proj.git
  hooks=$dir/hooks
  test -d $hooks || { warn "not a git project name: $proj"; fail=1; }

  chattr -i $hooks && ln -sf --backup /usr/local/bin/git-update-hook \
      $hooks/update
  chattr +i $hooks
  git --git-dir=$dir config hooks.denymerge.master true
done
exit $fail




reply via email to

[Prev in Thread] Current Thread [Next in Thread]