diff options
Diffstat (limited to 'mergetools')
-rw-r--r-- | mergetools/defaults | 22 | ||||
-rw-r--r-- | mergetools/gvimdiff | 1 | ||||
-rw-r--r-- | mergetools/gvimdiff2 | 1 | ||||
-rw-r--r-- | mergetools/kdiff3 | 2 | ||||
-rw-r--r-- | mergetools/p4merge | 35 | ||||
-rw-r--r-- | mergetools/tortoisemerge | 25 | ||||
-rw-r--r-- | mergetools/vimdiff (renamed from mergetools/vim) | 12 | ||||
-rw-r--r-- | mergetools/vimdiff2 | 1 |
8 files changed, 46 insertions, 53 deletions
diff --git a/mergetools/defaults b/mergetools/defaults deleted file mode 100644 index 21e63ecc3e..0000000000 --- a/mergetools/defaults +++ /dev/null @@ -1,22 +0,0 @@ -# Redefined by builtin tools -can_merge () { - return 0 -} - -can_diff () { - return 0 -} - -diff_cmd () { - status=1 - return $status -} - -merge_cmd () { - status=1 - return $status -} - -translate_merge_tool_path () { - echo "$1" -} diff --git a/mergetools/gvimdiff b/mergetools/gvimdiff new file mode 100644 index 0000000000..04a5bb0ea8 --- /dev/null +++ b/mergetools/gvimdiff @@ -0,0 +1 @@ +. "$MERGE_TOOLS_DIR/vimdiff" diff --git a/mergetools/gvimdiff2 b/mergetools/gvimdiff2 new file mode 100644 index 0000000000..04a5bb0ea8 --- /dev/null +++ b/mergetools/gvimdiff2 @@ -0,0 +1 @@ +. "$MERGE_TOOLS_DIR/vimdiff" diff --git a/mergetools/kdiff3 b/mergetools/kdiff3 index 28fead428b..a30034f116 100644 --- a/mergetools/kdiff3 +++ b/mergetools/kdiff3 @@ -1,5 +1,5 @@ diff_cmd () { - "$merge_tool_path" --auto \ + "$merge_tool_path" \ --L1 "$MERGED (A)" --L2 "$MERGED (B)" \ "$LOCAL" "$REMOTE" >/dev/null 2>&1 } diff --git a/mergetools/p4merge b/mergetools/p4merge index 295361a8aa..5a608abf9c 100644 --- a/mergetools/p4merge +++ b/mergetools/p4merge @@ -1,35 +1,38 @@ diff_cmd () { + empty_file= + # p4merge does not like /dev/null - rm_local= - rm_remote= if test "/dev/null" = "$LOCAL" then - LOCAL="./p4merge-dev-null.LOCAL.$$" - >"$LOCAL" - rm_local=true + LOCAL="$(create_empty_file)" fi if test "/dev/null" = "$REMOTE" then - REMOTE="./p4merge-dev-null.REMOTE.$$" - >"$REMOTE" - rm_remote=true + REMOTE="$(create_empty_file)" fi "$merge_tool_path" "$LOCAL" "$REMOTE" - if test -n "$rm_local" - then - rm -f "$LOCAL" - fi - if test -n "$rm_remote" + if test -n "$empty_file" then - rm -f "$REMOTE" + rm -f "$empty_file" fi } merge_cmd () { touch "$BACKUP" - $base_present || >"$BASE" - "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" "$MERGED" + if ! $base_present + then + cp -- "$LOCAL" "$BASE" + create_virtual_base "$BASE" "$REMOTE" + fi + "$merge_tool_path" "$BASE" "$REMOTE" "$LOCAL" "$MERGED" check_unchanged } + +create_empty_file () { + empty_file="${TMPDIR:-/tmp}/git-difftool-p4merge-empty-file.$$" + >"$empty_file" + + printf "%s" "$empty_file" +} diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge index ed7db495ed..3b89f1c82d 100644 --- a/mergetools/tortoisemerge +++ b/mergetools/tortoisemerge @@ -6,12 +6,29 @@ merge_cmd () { if $base_present then touch "$BACKUP" - "$merge_tool_path" \ - -base:"$BASE" -mine:"$LOCAL" \ - -theirs:"$REMOTE" -merged:"$MERGED" + basename="$(basename "$merge_tool_path" .exe)" + if test "$basename" = "tortoisegitmerge" + then + "$merge_tool_path" \ + -base "$BASE" -mine "$LOCAL" \ + -theirs "$REMOTE" -merged "$MERGED" + else + "$merge_tool_path" \ + -base:"$BASE" -mine:"$LOCAL" \ + -theirs:"$REMOTE" -merged:"$MERGED" + fi check_unchanged else - echo "TortoiseMerge cannot be used without a base" 1>&2 + echo "$merge_tool_path cannot be used without a base" 1>&2 return 1 fi } + +translate_merge_tool_path() { + if type tortoisegitmerge >/dev/null 2>/dev/null + then + echo tortoisegitmerge + else + echo tortoisemerge + fi +} diff --git a/mergetools/vim b/mergetools/vimdiff index 619594ae4b..39d032771b 100644 --- a/mergetools/vim +++ b/mergetools/vimdiff @@ -1,14 +1,6 @@ diff_cmd () { - case "$1" in - gvimdiff|vimdiff) - "$merge_tool_path" -R -f -d \ - -c 'wincmd l' -c 'cd $GIT_PREFIX' "$LOCAL" "$REMOTE" - ;; - gvimdiff2|vimdiff2) - "$merge_tool_path" -R -f -d \ - -c 'wincmd l' -c 'cd $GIT_PREFIX' "$LOCAL" "$REMOTE" - ;; - esac + "$merge_tool_path" -R -f -d \ + -c 'wincmd l' -c 'cd $GIT_PREFIX' "$LOCAL" "$REMOTE" } merge_cmd () { diff --git a/mergetools/vimdiff2 b/mergetools/vimdiff2 new file mode 100644 index 0000000000..04a5bb0ea8 --- /dev/null +++ b/mergetools/vimdiff2 @@ -0,0 +1 @@ +. "$MERGE_TOOLS_DIR/vimdiff" |