git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Please pull mergetool.git
@ 2007-06-10 16:03 Theodore Ts'o
  2007-06-10 19:55 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Theodore Ts'o @ 2007-06-10 16:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Hi Junio,

Please pull from the "mergetool" branch at:
	git://repo.or.cz/git/mergetool.git mergetool

It adds support for vimdiff/gvimdiff as a mergetool program, as well
Josh's suggestion of making the default merge-tool selection more
intelligent, although I've rewritten it somewhat take into account the
comments made by you and others on the git mailing list.

(Note that as of this writing, meld is a pretty sad/dificient tool, and
even GNOME users may very well prefer kdiff3 over meld --- which is my
default.  Still, it seems reasonable to default to using KDE tools in an
KDE login session, and GNOME tools in a GNOME login session, and people
who care differently should set their own preferences in ~/.gitconfig.)

						- Ted


Dan McGee (1):
      git-mergetool: Allow gvimdiff to be used as a mergetool

Theodore Ts'o (2):
      git-mergetool: Make default selection of merge-tool more intelligent
      Add git-applymbox, git-applypatch, and *~ to .gitignore

 b/.gitignore                      |    3 ++
 b/Documentation/config.txt        |    2 -
 b/Documentation/git-mergetool.txt |    2 -
 b/git-mergetool.sh                |   46 +++++++++++++++++++++++---------------
 git-mergetool.sh                  |   12 ++++++++-
 5 files changed, 44 insertions(+), 21 deletions(-)

diff --git a/.gitignore b/.gitignore
index 27e5aeb..70a4a68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,8 @@ git-add--interactive
 git-am
 git-annotate
 git-apply
+git-applymbox
+git-applypatch
 git-archimport
 git-archive
 git-bisect
@@ -161,6 +163,7 @@ git-core.spec
 *.exe
 *.[ao]
 *.py[co]
+*~
 config.mak
 autom4te.cache
 config.cache
diff --git a/Documentation/config.txt b/Documentation/config.txt
index de408b6..a2057d9 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -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
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
index b89c51c..6c32c6d 100644
--- a/Documentation/git-mergetool.txt
+++ b/Documentation/git-mergetool.txt
@@ -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
diff --git a/git-mergetool.sh b/git-mergetool.sh
index bb21b03..7b66309 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -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
@@ -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"
@@ -304,28 +310,42 @@ if test -z "$merge_tool"; then
 fi
 
 if test -z "$merge_tool" ; then
-    if type kdiff3 >/dev/null 2>&1 && test -n "$DISPLAY"; then
-	merge_tool="kdiff3";
-    elif type tkdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
-	merge_tool=tkdiff
-    elif type xxdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
-	merge_tool=xxdiff
-    elif type meld >/dev/null 2>&1 && test -n "$DISPLAY"; then
-	merge_tool=meld
-    elif type opendiff >/dev/null 2>&1; then
-	merge_tool=opendiff
-    elif type emacs >/dev/null 2>&1; then
-	merge_tool=emerge
-    elif type vimdiff >/dev/null 2>&1; then
-	merge_tool=vimdiff
-    else
+    if test -n "$DISPLAY"; then
+        merge_tool_candidates="kdiff3 tkdiff xxdiff meld gvimdiff"
+        if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
+            merge_tool_candidates="meld $merge_tool_candidates"
+        fi
+        if test "$KDE_FULL_SESSION" = "true"; then
+            merge_tool_candidates="kdiff3 $merge_tool_candidates"
+        fi
+    fi
+    if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
+        merge_tool_candidates="$merge_tool_candidates emerge"
+    fi
+    if echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
+        merge_tool_candidates="$merge_tool_candidates vimdiff"
+    fi
+    merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
+    echo "merge tool candidates: $merge_tool_candidates"
+    for i in $merge_tool_candidates; do
+        if test $i = emerge ; then
+            cmd=emacs
+        else
+            cmd=$i
+        fi
+        if type $cmd > /dev/null 2>&1; then
+            merge_tool=$i
+            break
+        fi
+    done
+    if test -z "$merge_tool" ; then
 	echo "No available merge resolution programs available."
 	exit 1
     fi
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-06-10 16:03 Please pull mergetool.git Theodore Ts'o
@ 2007-06-10 19:55 ` Junio C Hamano
  2007-06-10 21:31   ` Theodore Tso
  2007-06-10 23:29   ` Brian Gernhardt
  0 siblings, 2 replies; 9+ messages in thread
From: Junio C Hamano @ 2007-06-10 19:55 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Git Mailing List

"Theodore Ts'o" <tytso@mit.edu> writes:

> Please pull from the "mergetool" branch at:
> 	git://repo.or.cz/git/mergetool.git mergetool
>
> It adds support for vimdiff/gvimdiff as a mergetool program, as well
> Josh's suggestion of making the default merge-tool selection more
> intelligent, although I've rewritten it somewhat take into account the
> comments made by you and others on the git mailing list.
>
> (Note that as of this writing, meld is a pretty sad/dificient tool, and
> even GNOME users may very well prefer kdiff3 over meld --- which is my
> default.  Still, it seems reasonable to default to using KDE tools in an
> KDE login session, and GNOME tools in a GNOME login session, and people
> who care differently should set their own preferences in ~/.gitconfig.)

Thanks for keeping track of the mergetool.

I do not see problems in the mergetool part, other than that I
mildly suspect that opendiff -- actually FileMerge -- might want
to be in the test -n "$DISPLAY" section, but that is inherited
from the previous iteration so in that sense leaving outside is
a sane thing to do.

> Dan McGee (1):
>       git-mergetool: Allow gvimdiff to be used as a mergetool
>
> Theodore Ts'o (2):
>       git-mergetool: Make default selection of merge-tool more intelligent
>       Add git-applymbox, git-applypatch, and *~ to .gitignore

But I hope you would not be offended if I said I do not want to.

This is not such a strong objection, but I really wish that you
did not mix in the .gitignore change; it does not belong to this
"series".

If it were an obvious and universally nondisagreeable fix, I
would not mind you mixing it in this mergetool updates, but I am
of two minds about the .gitignore change, and actually slightly
in favor of not adding git-applymbox and git-applypatch back.

About git-applymbox and git-applypatch, it helps people when
they switch branches and/or bisect to keep potential build
products from older/different revisions listed in .gitignore.
That would however imply we would end up carrying old entries
forever in it.  We do not keep clean rule in Makefile to remove
build products from older/different revisions when remove build
targets, so why should we keep them in .gitignore?

Also I deliberately have kept *~ out of .gitignore for a reason.
I do have that entry in .git/info/exclude, but the choice of
Emacs over vi is personal to me.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-06-10 19:55 ` Junio C Hamano
@ 2007-06-10 21:31   ` Theodore Tso
  2007-06-10 23:29   ` Brian Gernhardt
  1 sibling, 0 replies; 9+ messages in thread
From: Theodore Tso @ 2007-06-10 21:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Sun, Jun 10, 2007 at 12:55:13PM -0700, Junio C Hamano wrote:
> But I hope you would not be offended if I said I do not want to.
> 
> This is not such a strong objection, but I really wish that you
> did not mix in the .gitignore change; it does not belong to this
> "series".

OK, no problem.  It was something I noticed while I was preparing the
series, and I thought it was non-controverisal enough to just throw it
in.  It's at the tail of the series, so it's easy enough for me to do a 

	git reset --hard HEAD^

on the mergetool branch....   OK, done.  If you pull from 

        git://repo.or.cz/git/mergetool.git mergetool

You'll only get the first two changes to git-mergetool, and the
.gitignore change has been dropped.

Regards,

					- Ted

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-06-10 19:55 ` Junio C Hamano
  2007-06-10 21:31   ` Theodore Tso
@ 2007-06-10 23:29   ` Brian Gernhardt
  2007-06-11  1:02     ` Junio C Hamano
  1 sibling, 1 reply; 9+ messages in thread
From: Brian Gernhardt @ 2007-06-10 23:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Theodore Ts'o, Git Mailing List


On Jun 10, 2007, at 3:55 PM, Junio C Hamano wrote:

> I do not see problems in the mergetool part, other than that I
> mildly suspect that opendiff -- actually FileMerge -- might want
> to be in the test -n "$DISPLAY" section, but that is inherited
> from the previous iteration so in that sense leaving outside is
> a sane thing to do.

Actually, opendiff (as FileMerge.app) is available under OS X, where  
$DISPLAY is not set.

~~ Brian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-06-10 23:29   ` Brian Gernhardt
@ 2007-06-11  1:02     ` Junio C Hamano
  2007-06-11  1:55       ` Martin Langhoff
  0 siblings, 1 reply; 9+ messages in thread
From: Junio C Hamano @ 2007-06-11  1:02 UTC (permalink / raw)
  To: Brian Gernhardt; +Cc: Theodore Ts'o, Git Mailing List

Brian Gernhardt <benji@silverinsanity.com> writes:

> On Jun 10, 2007, at 3:55 PM, Junio C Hamano wrote:
>
>> I do not see problems in the mergetool part, other than that I
>> mildly suspect that opendiff -- actually FileMerge -- might want
>> to be in the test -n "$DISPLAY" section, but that is inherited
>> from the previous iteration so in that sense leaving outside is
>> a sane thing to do.
>
> Actually, opendiff (as FileMerge.app) is available under OS X, where
> $DISPLAY is not set.

Heh, a graphical environment that does not use DISPLAY...

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-06-11  1:02     ` Junio C Hamano
@ 2007-06-11  1:55       ` Martin Langhoff
  2007-06-11 13:31         ` Theodore Tso
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Langhoff @ 2007-06-11  1:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Brian Gernhardt, Theodore Ts'o, Git Mailing List

On 6/11/07, Junio C Hamano <gitster@pobox.com> wrote:
> Brian Gernhardt <benji@silverinsanity.com> writes:
> > Actually, opendiff (as FileMerge.app) is available under OS X, where
> > $DISPLAY is not set.
>
> Heh, a graphical environment that does not use DISPLAY...

FWIW, it depends on whether you are using xterm (DISPLAY is set) or
Terminal.app (DISPLAY may not be set). In any case FileMerge.app will
ignore DISPLAY.

cheers,


m

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-06-11  1:55       ` Martin Langhoff
@ 2007-06-11 13:31         ` Theodore Tso
  0 siblings, 0 replies; 9+ messages in thread
From: Theodore Tso @ 2007-06-11 13:31 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Junio C Hamano, Brian Gernhardt, Git Mailing List

On Mon, Jun 11, 2007 at 01:55:25PM +1200, Martin Langhoff wrote:
> FWIW, it depends on whether you are using xterm (DISPLAY is set) or
> Terminal.app (DISPLAY may not be set). In any case FileMerge.app will
> ignore DISPLAY.

Is there a reliable way on MacOS to determine whether the user is
sitting in front of the terminal, as opposed to logged into the MacOS
box remotely?  Ideally we would only try opendiff/FileMerge.app if we
new that the user is indeed sitting in front of the graphical display.

						- Ted

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Please pull mergetool.git
@ 2007-09-29 14:47 Theodore Ts'o
  2007-09-29 22:43 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Theodore Ts'o @ 2007-09-29 14:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Hi Junio,

Please pull from the "mergetool" branch at:
        git://repo.or.cz/git/mergetool.git mergetool

It contains the bug fixes for git mergetool discussed recently, and is
against the maint branch.   Thanks!

						- Ted

Junio C Hamano (1):
      Mergetool generating blank files (1.5.3)

Theodore Ts'o (2):
      mergetool: fix emerge when running in a subdirectory
      mergetool: Fix typo in options passed to kdiff3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Please pull mergetool.git
  2007-09-29 14:47 Theodore Ts'o
@ 2007-09-29 22:43 ` Junio C Hamano
  0 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2007-09-29 22:43 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Git Mailing List

Thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-09-29 22:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-10 16:03 Please pull mergetool.git Theodore Ts'o
2007-06-10 19:55 ` Junio C Hamano
2007-06-10 21:31   ` Theodore Tso
2007-06-10 23:29   ` Brian Gernhardt
2007-06-11  1:02     ` Junio C Hamano
2007-06-11  1:55       ` Martin Langhoff
2007-06-11 13:31         ` Theodore Tso
  -- strict thread matches above, loose matches on Subject: below --
2007-09-29 14:47 Theodore Ts'o
2007-09-29 22:43 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).