diff options
Diffstat (limited to 'git-mergetool--lib.sh')
-rw-r--r-- | git-mergetool--lib.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 4db9212331..9a89e8f319 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -79,13 +79,18 @@ get_merge_tool_cmd () { fi if diff_mode; then echo "$(git config difftool.$merge_tool.cmd || - git config mergetool.$merge_tool.cmd)" + git config mergetool.$merge_tool.cmd)" else echo "$(git config mergetool.$merge_tool.cmd)" fi } run_merge_tool () { + # If GIT_PREFIX is empty then we cannot use it in tools + # that expect to be able to chdir() to its value. + GIT_PREFIX=${GIT_PREFIX:-.} + export GIT_PREFIX + merge_tool_path="$(get_merge_tool_path "$1")" || exit base_present="$2" status=0 @@ -188,6 +193,7 @@ run_merge_tool () { check_unchanged else "$merge_tool_path" -R -f -d -c "wincmd l" \ + -c 'cd $GIT_PREFIX' \ "$LOCAL" "$REMOTE" fi ;; @@ -199,6 +205,7 @@ run_merge_tool () { check_unchanged else "$merge_tool_path" -R -f -d -c "wincmd l" \ + -c 'cd $GIT_PREFIX' \ "$LOCAL" "$REMOTE" fi ;; @@ -412,7 +419,7 @@ get_merge_tool_path () { fi if diff_mode; then merge_tool_path=$(git config difftool."$merge_tool".path || - git config mergetool."$merge_tool".path) + git config mergetool."$merge_tool".path) else merge_tool_path=$(git config mergetool."$merge_tool".path) fi @@ -422,7 +429,7 @@ get_merge_tool_path () { if test -z "$(get_merge_tool_cmd "$merge_tool")" && ! type "$merge_tool_path" > /dev/null 2>&1; then echo >&2 "The $TOOL_MODE tool $merge_tool is not available as"\ - "'$merge_tool_path'" + "'$merge_tool_path'" exit 1 fi echo "$merge_tool_path" |