do not merge, if not coming from the master branch

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2014-01-20 14:43:48 +01:00
parent e40fde92fc
commit f034ed6027
1 changed files with 13 additions and 8 deletions

View File

@ -205,25 +205,30 @@ eof
fi fi
# Ensure we are on the master branch # Ensure we are on the master branch
masterbranch=yes
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
echo "Releases are happening from the master branch, aborting" echo "Releases are happening from the master branch, aborting"
echo "Enter the magic word to release anyway" echo "Enter the magic word to release anyway"
read magicword read magicword
if [ "$magicword" != "iknowwhatido" ]; then if [ "$magicword" = "iknowwhatido" ]; then
masterbranch=no
else
exit 1 exit 1
fi fi
fi fi
# Ensure version branch exists if [ "$masterbranch" = yes ]; then
if ! git rev-parse --verify refs/heads/$target_branch 2>/dev/null; then # Ensure version branch exists
git branch "$target_branch" if ! git rev-parse --verify refs/heads/$target_branch 2>/dev/null; then
fi git branch "$target_branch"
fi
# Merge master branch into version branch # Merge master branch into version branch
git checkout "$target_branch" git checkout "$target_branch"
git merge master git merge master
fi
# Verify that after the merge everything works # Verify that after the merge everything works
"$0" check-date "$0" check-date