Skip to content

Commit

Permalink
mergetools/diffmerge: support DiffMerge as a git mergetool
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Saasen authored and Jonathan Nieder committed Oct 13, 2013
1 parent 22bbdde commit c5f424f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
"

Expand Down
3 changes: 2 additions & 1 deletion git-mergetool--lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down
15 changes: 15 additions & 0 deletions mergetools/diffmerge
Original file line number Diff line number Diff line change
@@ -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=$?
}

0 comments on commit c5f424f

Please sign in to comment.