github-merge-pr: add check for working on clean branch
[maintainer-tools.git] / github-merge-pr.sh
index f8758d3334abefc374dee24ef6ccdf925ca8bbc6..f7325dbf54c1b114cdfa389dcedb2683e573d85a 100755 (executable)
@@ -107,6 +107,11 @@ fi
 echo "Returning to $BRANCH"
 $GIT checkout $BRANCH
 
+if [ -n "$($GIT log origin/$BRANCH..HEAD)" ]; then
+       echo "Working on dirty branch for $BRANCH! Please reset $BRANCH to origin/$BRANCH" >&2
+       exit 10
+fi
+
 echo "Actually merging the PR #$PRID from branch $PR_USER/$PR_BRANCH"
 if ! $GIT merge --ff-only $PR_USER/$PR_BRANCH; then
        echo "Failed to merge $PR_USER/$PR_BRANCH on $BRANCH" >&2