summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 682b451)
raw | patch | inline | side by side (parent: 682b451)
author | Charles Bailey <charles@hashpling.org> | |
Fri, 12 Dec 2008 21:48:40 +0000 (21:48 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 13 Dec 2008 04:53:41 +0000 (20:53 -0800) |
This option stops git mergetool from aborting at the first failed merge.
After a failed merge the user will be prompted to indicated whether he
wishes to continue with attempting to merge subsequent paths or to
abort.
This allows some additional use patterns. Merge conflicts can now be
previewed one at time and merges can also be skipped so that they can be
performed in a later pass.
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
After a failed merge the user will be prompted to indicated whether he
wishes to continue with attempting to merge subsequent paths or to
abort.
This allows some additional use patterns. Merge conflicts can now be
previewed one at time and merges can also be skipped so that they can be
performed in a later pass.
Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-mergetool.sh | patch | blob | history |
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 507028f8597ef7a288ab7dd5c4d5a5163585380a..5144971647c177533bfe6cdd1be974bd60555728 100755 (executable)
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
git checkout-index -f --stage=2 -- "$MERGED"
git add -- "$MERGED"
cleanup_temp_files --save-backup
- return
+ return 0
;;
[rR]*)
git checkout-index -f --stage=3 -- "$MERGED"
git add -- "$MERGED"
cleanup_temp_files --save-backup
- return
+ return 0
;;
[aA]*)
- exit 1
+ return 1
;;
esac
done
[mMcC]*)
git add -- "$MERGED"
cleanup_temp_files --save-backup
- return
+ return 0
;;
[dD]*)
git rm -- "$MERGED" > /dev/null
cleanup_temp_files
- return
+ return 0
;;
[aA]*)
- exit 1
+ return 1
;;
esac
done
else
echo "$MERGED: file does not need merging"
fi
- exit 1
+ return 1
fi
ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
if test "$status" -ne 0; then
echo "merge of $MERGED failed" 1>&2
mv -- "$BACKUP" "$MERGED"
- exit 1
+ return 1
fi
if test "$merge_keep_backup" = "true"; then
git add -- "$MERGED"
cleanup_temp_files
+ return 0
}
prompt=$(git config --bool mergetool.prompt || echo true)
fi
}
+prompt_after_failed_merge() {
+ while true; do
+ printf "Continue merging other unresolved paths (y/n) ? "
+ read ans
+ case "$ans" in
+
+ [yY]*)
+ return 0
+ ;;
+
+ [nN]*)
+ return 1
+ ;;
+ esac
+ done
+}
if test -z "$merge_tool"; then
merge_tool=`git config merge.tool`
fi
fi
+last_status=0
+rollup_status=0
if test $# -eq 0 ; then
files=`git ls-files -u | sed -e 's/^[^ ]* //' | sort -u`
sort -u |
while IFS= read i
do
+ if test $last_status -ne 0; then
+ prompt_after_failed_merge < /dev/tty || exit 1
+ fi
printf "\n"
merge_file "$i" < /dev/tty > /dev/tty
+ last_status=$?
+ if test $last_status -ne 0; then
+ rollup_status=1
+ fi
done
else
while test $# -gt 0; do
+ if test $last_status -ne 0; then
+ prompt_after_failed_merge || exit 1
+ fi
printf "\n"
merge_file "$1"
+ last_status=$?
+ if test $last_status -ne 0; then
+ rollup_status=1
+ fi
shift
done
fi
-exit 0
+
+exit $rollup_status