aboutsummaryrefslogtreecommitdiff
path: root/git-mergetool.sh
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2016-10-07 16:58:05 -0700
committerJunio C Hamano <gitster@pobox.com>2016-10-11 10:04:27 -0700
commit57937f70a09c12ef484c290865dac4066d207c9c (patch)
treed44cb9e278c3e42c2f0fa3b446ff021e8512f722 /git-mergetool.sh
parent08221e3fa27396aca30cb539f006f78636782951 (diff)
downloadgit-57937f70a09c12ef484c290865dac4066d207c9c.tar.gz
git-57937f70a09c12ef484c290865dac4066d207c9c.tar.xz
mergetool: honor diff.orderFile
Teach mergetool to get the list of files to edit via `diff` so that we gain support for diff.orderFile. Suggested-by: Luis Gutierrez <luisgutz@gmail.com> Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: David Aguilar <davvid@gmail.com> Reviewed-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-mergetool.sh')
-rwxr-xr-xgit-mergetool.sh30
1 files changed, 15 insertions, 15 deletions
diff --git a/git-mergetool.sh b/git-mergetool.sh
index b2cd0a497..65696d838 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -382,6 +382,11 @@ prompt_after_failed_merge () {
done
}
+print_noop_and_exit () {
+ echo "No files need merging"
+ exit 0
+}
+
main () {
prompt=$(git config --bool mergetool.prompt)
guessed_merge_tool=false
@@ -445,28 +450,23 @@ main () {
merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)"
merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)"
- files=
-
- if test $# -eq 0
+ if test $# -eq 0 && test -e "$GIT_DIR/MERGE_RR"
then
- cd_to_toplevel
-
- if test -e "$GIT_DIR/MERGE_RR"
+ set -- $(git rerere remaining)
+ if test $# -eq 0
then
- files=$(git rerere remaining)
- else
- files=$(git ls-files -u |
- sed -e 's/^[^ ]* //' | sort -u)
+ print_noop_and_exit
fi
- else
- files=$(git ls-files -u -- "$@" |
- sed -e 's/^[^ ]* //' | sort -u)
fi
+ files=$(git -c core.quotePath=false \
+ diff --name-only --diff-filter=U -- "$@")
+
+ cd_to_toplevel
+
if test -z "$files"
then
- echo "No files need merging"
- exit 0
+ print_noop_and_exit
fi
printf "Merging:\n"