From 5f979cdf8cd6d0c4503d311fefb6595459f952be Mon Sep 17 00:00:00 2001 From: Andy Tudhope Date: Mon, 15 Jan 2018 14:44:59 +0200 Subject: [PATCH] merge-pr script should prompt for multiple commits Fixes #2971 Because I don't think it is worth a bounty - all the code required was already in the `merge-external-pr.sh` so I have just copied the relevant parts across and added the few necessary lines to ensure that PRs from core contributors cannot be merged unless they have been squashed down to a single commit. Changed fatal to confirm for merge-pr --- scripts/merge-pr.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/merge-pr.sh b/scripts/merge-pr.sh index 9d22212c64..17e3967dff 100755 --- a/scripts/merge-pr.sh +++ b/scripts/merge-pr.sh @@ -8,6 +8,13 @@ if [[ $# -eq 0 ]] ; then exit 0 fi +confirm() { + read -p "$1 (type 'yes' to continue) " r + if [[ $r != yes ]]; then + exit 3 + fi +} + echo "[Merge PR from ${BRANCH}]" echo "[Update remote and checkout branch]" @@ -16,6 +23,9 @@ git checkout -B $BRANCH origin/$BRANCH && git pull echo "[Rebase and squash to one commit (manual)]" git rebase -i origin/develop +if [[ $(git rev-list $BRANCH..$PR_LOCAL_BRACNCH | wc -l) -ne 1 ]] ;then + confirm "There are multiple commits in this PR. Are you sure you wish to continue without squashing?" +fi echo "[Verify signature and commit (manual), update PR]" git show --show-signature