diff options
-rwxr-xr-x | git-mergetool.sh | 17 | ||||
-rwxr-xr-x | t/t7610-mergetool.sh | 7 |
2 files changed, 21 insertions, 3 deletions
diff --git a/git-mergetool.sh b/git-mergetool.sh index b506896dc1..c062e3de3a 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -454,6 +454,17 @@ main () { merge_keep_backup="$(git config --bool mergetool.keepBackup || echo true)" merge_keep_temporaries="$(git config --bool mergetool.keepTemporaries || echo false)" + prefix=$(git rev-parse --show-prefix) || exit 1 + cd_to_toplevel + + if test -n "$orderfile" + then + orderfile=$( + git rev-parse --prefix "$prefix" -- "$orderfile" | + sed -e 1d + ) + fi + if test $# -eq 0 && test -e "$GIT_DIR/MERGE_RR" then set -- $(git rerere remaining) @@ -461,14 +472,16 @@ main () { then print_noop_and_exit fi + elif test $# -ge 0 + then + # rev-parse provides the -- needed for 'set' + eval "set $(git rev-parse --sq --prefix "$prefix" -- "$@")" fi files=$(git -c core.quotePath=false \ diff --name-only --diff-filter=U \ ${orderfile:+"-O$orderfile"} -- "$@") - cd_to_toplevel - if test -z "$files" then print_noop_and_exit diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index ab0b005b28..180dd7057a 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -234,7 +234,7 @@ test_expect_success 'mergetool merges all from subdir (rerere disabled)' ' ) ' -test_expect_failure 'mergetool merges all from subdir (rerere enabled)' ' +test_expect_success 'mergetool merges all from subdir (rerere enabled)' ' test_when_finished "git reset --hard" && git checkout -b test$test_count branch1 && test_config rerere.enabled true && @@ -678,6 +678,11 @@ test_expect_success 'diff.orderFile configuration is honored' ' b a EOF + + # make sure "order-file" that is ambiguous between + # rev and path is understood correctly. + git branch order-file HEAD && + git mergetool --no-prompt --tool myecho >output && git grep --no-index -h -A2 Merging: output >actual && test_cmp expect actual |