X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-mergetool--lib.sh;h=91f90acfba2a710644f4a076d27d50e0fbb33c2d;hb=1acf11717f01b542e099544796f00df567a66e90;hp=fb3f52ba2507b4fb78db150b5c183f24bd2c57c1;hpb=1de0746d849c64e1f4d160f9915d87d39c0794ea;p=git.git diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index fb3f52ba2..91f90acfb 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -86,6 +86,11 @@ get_merge_tool_cmd () { } 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 ;; @@ -258,12 +265,9 @@ run_merge_tool () { ;; p4merge) if merge_mode; then - touch "$BACKUP" - if $base_present; then - "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED" - else - "$merge_tool_path" "$LOCAL" "$LOCAL" "$REMOTE" "$MERGED" - fi + touch "$BACKUP" + $base_present || >"$BASE" + "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED" check_unchanged else "$merge_tool_path" "$LOCAL" "$REMOTE"