From 7da455da65d4c6ca7c58cf915f158349184373f0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Aug 2011 16:28:02 +0200 Subject: Only allow fast-forward merges into master --- git/merge.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'git/merge.sh') diff --git a/git/merge.sh b/git/merge.sh index 4f12f8c..34da466 100755 --- a/git/merge.sh +++ b/git/merge.sh @@ -15,6 +15,22 @@ fi for i in $modules; do echo "merge $i" 1>&2 cd $i - git merge $* + + br=`git symbolic-ref -q HEAD` + br=`echo $br | sed -e 's%^refs/heads/%%'` + + # Only allow fast-forward merges into master. + # + if [ "$br" = "master" ]; then + git merge --ff-only $* + else + git merge $* + fi + + if [ $? -ne 0 ]; then + echo "merge FAILED" 1>&2 + exit 1 + fi + cd $wd done -- cgit v1.1