diff options
Diffstat (limited to 'mergetools')
-rw-r--r-- | mergetools/bc | 25 | ||||
-rw-r--r-- | mergetools/bc3 | 26 | ||||
-rw-r--r-- | mergetools/defaults | 22 | ||||
-rw-r--r-- | mergetools/diffmerge | 14 | ||||
-rw-r--r-- | mergetools/emerge | 1 | ||||
-rw-r--r-- | mergetools/gvimdiff | 1 | ||||
-rw-r--r-- | mergetools/gvimdiff2 | 1 | ||||
-rw-r--r-- | mergetools/gvimdiff3 | 1 | ||||
-rw-r--r-- | mergetools/kdiff3 | 3 | ||||
-rw-r--r-- | mergetools/meld | 9 | ||||
-rw-r--r-- | mergetools/p4merge | 32 | ||||
-rw-r--r-- | mergetools/tortoisemerge | 25 | ||||
-rw-r--r-- | mergetools/vimdiff (renamed from mergetools/vim) | 26 | ||||
-rw-r--r-- | mergetools/vimdiff2 | 1 | ||||
-rw-r--r-- | mergetools/vimdiff3 | 1 |
15 files changed, 118 insertions, 70 deletions
diff --git a/mergetools/bc b/mergetools/bc new file mode 100644 index 0000000000..b6319d206e --- /dev/null +++ b/mergetools/bc @@ -0,0 +1,25 @@ +diff_cmd () { + "$merge_tool_path" "$LOCAL" "$REMOTE" +} + +merge_cmd () { + touch "$BACKUP" + if $base_present + then + "$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" \ + -mergeoutput="$MERGED" + else + "$merge_tool_path" "$LOCAL" "$REMOTE" \ + -mergeoutput="$MERGED" + fi + check_unchanged +} + +translate_merge_tool_path() { + if type bcomp >/dev/null 2>/dev/null + then + echo bcomp + else + echo bcompare + fi +} diff --git a/mergetools/bc3 b/mergetools/bc3 index b6319d206e..5d8dd48184 100644 --- a/mergetools/bc3 +++ b/mergetools/bc3 @@ -1,25 +1 @@ -diff_cmd () { - "$merge_tool_path" "$LOCAL" "$REMOTE" -} - -merge_cmd () { - touch "$BACKUP" - if $base_present - then - "$merge_tool_path" "$LOCAL" "$REMOTE" "$BASE" \ - -mergeoutput="$MERGED" - else - "$merge_tool_path" "$LOCAL" "$REMOTE" \ - -mergeoutput="$MERGED" - fi - check_unchanged -} - -translate_merge_tool_path() { - if type bcomp >/dev/null 2>/dev/null - then - echo bcomp - else - echo bcompare - fi -} +. "$MERGE_TOOLS_DIR/bc" 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/diffmerge b/mergetools/diffmerge new file mode 100644 index 0000000000..f138cb4e73 --- /dev/null +++ b/mergetools/diffmerge @@ -0,0 +1,14 @@ +diff_cmd () { + "$merge_tool_path" "$LOCAL" "$REMOTE" >/dev/null 2>&1 +} + +merge_cmd () { + if $base_present + then + "$merge_tool_path" --merge --result="$MERGED" \ + "$LOCAL" "$BASE" "$REMOTE" + else + "$merge_tool_path" --merge \ + --result="$MERGED" "$LOCAL" "$REMOTE" + fi +} diff --git a/mergetools/emerge b/mergetools/emerge index f96d9e550a..7b895fdb1f 100644 --- a/mergetools/emerge +++ b/mergetools/emerge @@ -15,7 +15,6 @@ merge_cmd () { "$LOCAL" "$REMOTE" \ "$(basename "$MERGED")" fi - status=$? } translate_merge_tool_path() { 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/gvimdiff3 b/mergetools/gvimdiff3 new file mode 100644 index 0000000000..04a5bb0ea8 --- /dev/null +++ b/mergetools/gvimdiff3 @@ -0,0 +1 @@ +. "$MERGE_TOOLS_DIR/vimdiff" diff --git a/mergetools/kdiff3 b/mergetools/kdiff3 index 28fead428b..793d1293b1 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 } @@ -20,5 +20,4 @@ merge_cmd () { -o "$MERGED" "$LOCAL" "$REMOTE" \ >/dev/null 2>&1 fi - status=$? } diff --git a/mergetools/meld b/mergetools/meld index cb672a5519..83ebdfb4c3 100644 --- a/mergetools/meld +++ b/mergetools/meld @@ -18,13 +18,18 @@ merge_cmd () { check_unchanged } -# Check whether 'meld --output <file>' is supported +# Check whether we should use 'meld --output <file>' check_meld_for_output_version () { meld_path="$(git config mergetool.meld.path)" meld_path="${meld_path:-meld}" - if "$meld_path" --help 2>&1 | grep -e --output >/dev/null + if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput) then + : use configured value + elif "$meld_path" --help 2>&1 | + grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null + then + : old ones mention --output and new ones just say OPTION... meld_has_output_option=true else meld_has_output_option=false diff --git a/mergetools/p4merge b/mergetools/p4merge index 1a45c1b0c5..5a608abf9c 100644 --- a/mergetools/p4merge +++ b/mergetools/p4merge @@ -1,10 +1,38 @@ diff_cmd () { + empty_file= + + # p4merge does not like /dev/null + if test "/dev/null" = "$LOCAL" + then + LOCAL="$(create_empty_file)" + fi + if test "/dev/null" = "$REMOTE" + then + REMOTE="$(create_empty_file)" + fi + "$merge_tool_path" "$LOCAL" "$REMOTE" + + if test -n "$empty_file" + then + 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..1ddfbfcd78 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 () { @@ -28,16 +20,26 @@ merge_cmd () { "$merge_tool_path" -f -d -c 'wincmd l' \ "$LOCAL" "$MERGED" "$REMOTE" ;; + gvimdiff3|vimdiff3) + if $base_present + then + "$merge_tool_path" -f -d -c 'hid | hid | hid' \ + "$LOCAL" "$REMOTE" "$BASE" "$MERGED" + else + "$merge_tool_path" -f -d -c 'hid | hid' \ + "$LOCAL" "$REMOTE" "$MERGED" + fi + ;; esac check_unchanged } translate_merge_tool_path() { case "$1" in - gvimdiff|gvimdiff2) + gvimdiff|gvimdiff2|gvimdiff3) echo gvim ;; - vimdiff|vimdiff2) + vimdiff|vimdiff2|vimdiff3) echo vim ;; esac 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" diff --git a/mergetools/vimdiff3 b/mergetools/vimdiff3 new file mode 100644 index 0000000000..04a5bb0ea8 --- /dev/null +++ b/mergetools/vimdiff3 @@ -0,0 +1 @@ +. "$MERGE_TOOLS_DIR/vimdiff" |