Skip to content

Commit

Permalink
[PATCH] git-mergetool: Allow gvimdiff to be used as a mergetool
Browse files Browse the repository at this point in the history
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Dan McGee authored and Theodore Ts'o committed Jun 10, 2007
1 parent e58db03 commit 730b5b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Documentation/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ merge.summary::
merge.tool::
Controls which merge resolution program is used by
gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff",
"meld", "xxdiff", "emerge", "vimdiff", and "opendiff"
"meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and "opendiff".

merge.verbosity::
Controls the amount of output shown by the recursive merge
Expand Down
2 changes: 1 addition & 1 deletion Documentation/git-mergetool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ OPTIONS
-t or --tool=<tool>::
Use the merge resolution program specified by <tool>.
Valid merge tools are:
kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, and opendiff
kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, and opendiff
+
If a merge resolution program is not specified, 'git mergetool'
will use the configuration variable merge.tool. If the
Expand Down
12 changes: 10 additions & 2 deletions git-mergetool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ merge_file () {
check_unchanged
save_backup
;;
gvimdiff)
touch "$BACKUP"
gvimdiff -f -- "$LOCAL" "$path" "$REMOTE"
check_unchanged
save_backup
;;
xxdiff)
touch "$BACKUP"
if base_present ; then
Expand Down Expand Up @@ -293,7 +299,7 @@ done
if test -z "$merge_tool"; then
merge_tool=`git-config merge.tool`
case "$merge_tool" in
kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | "")
kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | "")
;; # happy
*)
echo >&2 "git config option merge.tool set to unknown tool: $merge_tool"
Expand All @@ -312,6 +318,8 @@ if test -z "$merge_tool" ; then
merge_tool=xxdiff
elif type meld >/dev/null 2>&1 && test -n "$DISPLAY"; then
merge_tool=meld
elif type gvimdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
merge_tool=gvimdiff
elif type opendiff >/dev/null 2>&1; then
merge_tool=opendiff
elif type emacs >/dev/null 2>&1; then
Expand All @@ -325,7 +333,7 @@ if test -z "$merge_tool" ; then
fi

case "$merge_tool" in
kdiff3|tkdiff|meld|xxdiff|vimdiff|opendiff)
kdiff3|tkdiff|meld|xxdiff|vimdiff|gvimdiff|opendiff)
if ! type "$merge_tool" > /dev/null 2>&1; then
echo "The merge tool $merge_tool is not available"
exit 1
Expand Down

0 comments on commit 730b5b4

Please sign in to comment.