summaryrefslogtreecommitdiff
path: root/git/merge.sh
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:28:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:28:02 +0200
commit7da455da65d4c6ca7c58cf915f158349184373f0 (patch)
tree2e89517feb08a543fc0d5badb0f64bf76dd81f2e /git/merge.sh
parent081ac03127d9854844146877b526d28f8addc1cc (diff)
Only allow fast-forward merges into master
Diffstat (limited to 'git/merge.sh')
-rwxr-xr-xgit/merge.sh18
1 files changed, 17 insertions, 1 deletions
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