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
This commit is contained in:
Ade Attwood 2022-02-15 20:24:45 +00:00
parent 060fa3d5f9
commit f386272007

View file

@ -26,6 +26,17 @@ HELP
exit 1; exit 1;
fi 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 if [[ "$MERGE_BRANCH" == "--abort" ]]; then
# #