From f3862720078019023297d1f0ea13aecadafe004d Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Tue, 15 Feb 2022 20:24:45 +0000 Subject: [PATCH] feat(bin): detect merge conflicts in merge-patch When merge patching it will now detect if there is an unresolved conflict in your current branch and exit without doing anything. This is useful when merging multiple branches at once, if you hit a conflict half way though it would remove the "MERGE_PATCH" file and lose where you where in the patch Now the script will exit and not lose the position so you can `--continue` correctly after fixing the conflicts --- site-modules/core/files/bin/git-merge-patch | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/site-modules/core/files/bin/git-merge-patch b/site-modules/core/files/bin/git-merge-patch index bfc1fd6..7a3d2d6 100755 --- a/site-modules/core/files/bin/git-merge-patch +++ b/site-modules/core/files/bin/git-merge-patch @@ -26,6 +26,17 @@ HELP exit 1; fi +# +# Test for merge conflicts can abort if any are found. Theses need to be +# resolved before you can continue +# +if [[ ! -z "$(git diff --name-only --diff-filter=U)" ]]; then + echo "ERROR: Conflicts found, you need to resolve them before you continue your" + echo "merge-patch. Use 'git am --show-current-patch' to see the failed patch. Then you" + echo "can continue the merge-patch with 'git merge-patch --continue'" + + exit 1 +fi if [[ "$MERGE_BRANCH" == "--abort" ]]; then #