mergetools/diffmerge: support DiffMerge as a git mergetool
authorStefan Saasen <ssaasen@atlassian.com>
Sat, 12 Oct 2013 22:29:35 +0000 (09:29 +1100)
committerJonathan Nieder <jrnieder@gmail.com>
Sun, 13 Oct 2013 23:00:57 +0000 (16:00 -0700)
DiffMerge is a non-free (but gratis) tool that supports OS X, Windows and Linux.

See http://www.sourcegear.com/diffmerge/

DiffMerge includes a script `/usr/bin/diffmerge` that can be used to launch the
graphical compare tool.

This change adds mergetool support for DiffMerge and adds 'diffmerge' as an
option to the mergetool help.

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
contrib/completion/git-completion.bash
git-mergetool--lib.sh
mergetools/diffmerge [new file with mode: 0644]
index 86f77345fdd7ed24d8c76ac33900ff65bdaa32fa..dba3c15700fae1ae8a7a43fd7a6ad7a5b9cbd5dd 100644 (file)
@@ -1188,7 +1188,7 @@ _git_diff ()
        __git_complete_revlist_file
 }
 
-__git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
+__git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff
                        tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
 "
 
index feee6a4a0d3a970c94fe506070ddc497c4b40658..858bc37e80de90b8a15887759c612e2a9704f91a 100644 (file)
@@ -250,7 +250,8 @@ list_merge_tool_candidates () {
                else
                        tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
                fi
-               tools="$tools gvimdiff diffuse ecmerge p4merge araxis bc3 codecompare"
+               tools="$tools gvimdiff diffuse diffmerge ecmerge"
+               tools="$tools p4merge araxis bc3 codecompare"
        fi
        case "${VISUAL:-$EDITOR}" in
        *vim*)
diff --git a/mergetools/diffmerge b/mergetools/diffmerge
new file mode 100644 (file)
index 0000000..85ac720
--- /dev/null
@@ -0,0 +1,15 @@
+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
+       status=$?
+}