{"thread":{"id":"8541","subject":"Please pull mergetool.git","startedAt":"2007-06-10T16:03:33Z","lastAt":"2007-06-11T13:31:00Z","messageCount":7,"participants":["Theodore Ts'o","Junio C Hamano","Theodore Tso","Brian Gernhardt","Martin Langhoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"44620","messageId":"E1HxPt7-0007jV-6V@candygram.thunk.org","threadId":"8541","inReplyTo":null,"subject":"Please pull mergetool.git","fromName":"Theodore Ts'o","fromEmail":"tytso@mit.edu","sentAt":"2007-06-10T16:03:33Z","receivedAt":"2007-06-10T16:03:33Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"Hi Junio,\n\nPlease pull from the \"mergetool\" branch at:\n\tgit://repo.or.cz/git/mergetool.git mergetool\n\nIt adds support for vimdiff/gvimdiff as a mergetool program, as well\nJosh's suggestion of making the default merge-tool selection more\nintelligent, although I've rewritten it somewhat take into account the\ncomments made by you and others on the git mailing list.\n\n(Note that as of this writing, meld is a pretty sad/dificient tool, and\neven GNOME users may very well prefer kdiff3 over meld --- which is my\ndefault.  Still, it seems reasonable to default to using KDE tools in an\nKDE login session, and GNOME tools in a GNOME login session, and people\nwho care differently should set their own preferences in ~/.gitconfig.)\n\n\t\t\t\t\t\t- Ted\n\n\nDan McGee (1):\n      git-mergetool: Allow gvimdiff to be used as a mergetool\n\nTheodore Ts'o (2):\n      git-mergetool: Make default selection of merge-tool more intelligent\n      Add git-applymbox, git-applypatch, and *~ to .gitignore\n\n b/.gitignore                      |    3 ++\n b/Documentation/config.txt        |    2 -\n b/Documentation/git-mergetool.txt |    2 -\n b/git-mergetool.sh                |   46 +++++++++++++++++++++++---------------\n git-mergetool.sh                  |   12 ++++++++-\n 5 files changed, 44 insertions(+), 21 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 27e5aeb..70a4a68 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -7,6 +7,8 @@ git-add--interactive\n git-am\n git-annotate\n git-apply\n+git-applymbox\n+git-applypatch\n git-archimport\n git-archive\n git-bisect\n@@ -161,6 +163,7 @@ git-core.spec\n *.exe\n *.[ao]\n *.py[co]\n+*~\n config.mak\n autom4te.cache\n config.cache\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex de408b6..a2057d9 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -531,7 +531,7 @@ merge.summary::\n merge.tool::\n \tControls which merge resolution program is used by\n \tgitlink:git-mergetool[l].  Valid values are: \"kdiff3\", \"tkdiff\",\n-\t\"meld\", \"xxdiff\", \"emerge\", \"vimdiff\", and \"opendiff\"\n+\t\"meld\", \"xxdiff\", \"emerge\", \"vimdiff\", \"gvimdiff\", and \"opendiff\".\n \n merge.verbosity::\n \tControls the amount of output shown by the recursive merge\ndiff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt\nindex b89c51c..6c32c6d 100644\n--- a/Documentation/git-mergetool.txt\n+++ b/Documentation/git-mergetool.txt\n@@ -25,7 +25,7 @@ OPTIONS\n -t or --tool=<tool>::\n \tUse the merge resolution program specified by <tool>.\n \tValid merge tools are:\n-\tkdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, and opendiff\n+\tkdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, and opendiff\n +\n If a merge resolution program is not specified, 'git mergetool'\n will use the configuration variable merge.tool.  If the\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex bb21b03..7b66309 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -215,6 +215,12 @@ merge_file () {\n \t    check_unchanged\n \t    save_backup\n \t    ;;\n+\tgvimdiff)\n+\t\ttouch \"$BACKUP\"\n+\t\tgvimdiff -f -- \"$LOCAL\" \"$path\" \"$REMOTE\"\n+\t\tcheck_unchanged\n+\t\tsave_backup\n+\t\t;;\n \txxdiff)\n \t    touch \"$BACKUP\"\n \t    if base_present ; then\n@@ -293,7 +299,7 @@ done\n if test -z \"$merge_tool\"; then\n     merge_tool=`git-config merge.tool`\n     case \"$merge_tool\" in\n-\tkdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | \"\")\n+\tkdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | \"\")\n \t    ;; # happy\n \t*)\n \t    echo >&2 \"git config option merge.tool set to unknown tool: $merge_tool\"\n@@ -304,28 +310,42 @@ if test -z \"$merge_tool\"; then\n fi\n \n if test -z \"$merge_tool\" ; then\n-    if type kdiff3 >/dev/null 2>&1 && test -n \"$DISPLAY\"; then\n-\tmerge_tool=\"kdiff3\";\n-    elif type tkdiff >/dev/null 2>&1 && test -n \"$DISPLAY\"; then\n-\tmerge_tool=tkdiff\n-    elif type xxdiff >/dev/null 2>&1 && test -n \"$DISPLAY\"; then\n-\tmerge_tool=xxdiff\n-    elif type meld >/dev/null 2>&1 && test -n \"$DISPLAY\"; then\n-\tmerge_tool=meld\n-    elif type opendiff >/dev/null 2>&1; then\n-\tmerge_tool=opendiff\n-    elif type emacs >/dev/null 2>&1; then\n-\tmerge_tool=emerge\n-    elif type vimdiff >/dev/null 2>&1; then\n-\tmerge_tool=vimdiff\n-    else\n+    if test -n \"$DISPLAY\"; then\n+        merge_tool_candidates=\"kdiff3 tkdiff xxdiff meld gvimdiff\"\n+        if test -n \"$GNOME_DESKTOP_SESSION_ID\" ; then\n+            merge_tool_candidates=\"meld $merge_tool_candidates\"\n+        fi\n+        if test \"$KDE_FULL_SESSION\" = \"true\"; then\n+            merge_tool_candidates=\"kdiff3 $merge_tool_candidates\"\n+        fi\n+    fi\n+    if echo \"${VISUAL:-$EDITOR}\" | grep 'emacs' > /dev/null 2>&1; then\n+        merge_tool_candidates=\"$merge_tool_candidates emerge\"\n+    fi\n+    if echo \"${VISUAL:-$EDITOR}\" | grep 'vim' > /dev/null 2>&1; then\n+        merge_tool_candidates=\"$merge_tool_candidates vimdiff\"\n+    fi\n+    merge_tool_candidates=\"$merge_tool_candidates opendiff emerge vimdiff\"\n+    echo \"merge tool candidates: $merge_tool_candidates\"\n+    for i in $merge_tool_candidates; do\n+        if test $i = emerge ; then\n+            cmd=emacs\n+        else\n+            cmd=$i\n+        fi\n+        if type $cmd > /dev/null 2>&1; then\n+            merge_tool=$i\n+            break\n+        fi\n+    done\n+    if test -z \"$merge_tool\" ; then\n \techo \"No available merge resolution programs available.\"\n \texit 1\n     fi\n fi\n \n case \"$merge_tool\" in\n-    kdiff3|tkdiff|meld|xxdiff|vimdiff|opendiff)\n+    kdiff3|tkdiff|meld|xxdiff|vimdiff|gvimdiff|opendiff)\n \tif ! type \"$merge_tool\" > /dev/null 2>&1; then\n \t    echo \"The merge tool $merge_tool is not available\"\n \t    exit 1\n"},{"id":"44634","messageId":"7v1wgj8tzy.fsf@assigned-by-dhcp.cox.net","threadId":"8541","inReplyTo":"E1HxPt7-0007jV-6V@candygram.thunk.org","subject":"Re: Please pull mergetool.git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-10T19:55:13Z","receivedAt":"2007-06-10T19:55:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Theodore Ts'o\" <tytso@mit.edu> writes:\n\n> Please pull from the \"mergetool\" branch at:\n> \tgit://repo.or.cz/git/mergetool.git mergetool\n>\n> It adds support for vimdiff/gvimdiff as a mergetool program, as well\n> Josh's suggestion of making the default merge-tool selection more\n> intelligent, although I've rewritten it somewhat take into account the\n> comments made by you and others on the git mailing list.\n>\n> (Note that as of this writing, meld is a pretty sad/dificient tool, and\n> even GNOME users may very well prefer kdiff3 over meld --- which is my\n> default.  Still, it seems reasonable to default to using KDE tools in an\n> KDE login session, and GNOME tools in a GNOME login session, and people\n> who care differently should set their own preferences in ~/.gitconfig.)\n\nThanks for keeping track of the mergetool.\n\nI do not see problems in the mergetool part, other than that I\nmildly suspect that opendiff -- actually FileMerge -- might want\nto be in the test -n \"$DISPLAY\" section, but that is inherited\nfrom the previous iteration so in that sense leaving outside is\na sane thing to do.\n\n> Dan McGee (1):\n>       git-mergetool: Allow gvimdiff to be used as a mergetool\n>\n> Theodore Ts'o (2):\n>       git-mergetool: Make default selection of merge-tool more intelligent\n>       Add git-applymbox, git-applypatch, and *~ to .gitignore\n\nBut I hope you would not be offended if I said I do not want to.\n\nThis is not such a strong objection, but I really wish that you\ndid not mix in the .gitignore change; it does not belong to this\n\"series\".\n\nIf it were an obvious and universally nondisagreeable fix, I\nwould not mind you mixing it in this mergetool updates, but I am\nof two minds about the .gitignore change, and actually slightly\nin favor of not adding git-applymbox and git-applypatch back.\n\nAbout git-applymbox and git-applypatch, it helps people when\nthey switch branches and/or bisect to keep potential build\nproducts from older/different revisions listed in .gitignore.\nThat would however imply we would end up carrying old entries\nforever in it.  We do not keep clean rule in Makefile to remove\nbuild products from older/different revisions when remove build\ntargets, so why should we keep them in .gitignore?\n\nAlso I deliberately have kept *~ out of .gitignore for a reason.\nI do have that entry in .git/info/exclude, but the choice of\nEmacs over vi is personal to me.\n"},{"id":"44642","messageId":"20070610213117.GA15117@thunk.org","threadId":"8541","inReplyTo":"7v1wgj8tzy.fsf@assigned-by-dhcp.cox.net","subject":"Re: Please pull mergetool.git","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2007-06-10T21:31:17Z","receivedAt":"2007-06-10T21:31:17Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Sun, Jun 10, 2007 at 12:55:13PM -0700, Junio C Hamano wrote:\n> But I hope you would not be offended if I said I do not want to.\n> \n> This is not such a strong objection, but I really wish that you\n> did not mix in the .gitignore change; it does not belong to this\n> \"series\".\n\nOK, no problem.  It was something I noticed while I was preparing the\nseries, and I thought it was non-controverisal enough to just throw it\nin.  It's at the tail of the series, so it's easy enough for me to do a \n\n\tgit reset --hard HEAD^\n\non the mergetool branch....   OK, done.  If you pull from \n\n        git://repo.or.cz/git/mergetool.git mergetool\n\nYou'll only get the first two changes to git-mergetool, and the\n.gitignore change has been dropped.\n\nRegards,\n\n\t\t\t\t\t- Ted\n"},{"id":"44665","messageId":"26568045-F443-415E-A250-29C7DD3998A9@silverinsanity.com","threadId":"8541","inReplyTo":"7v1wgj8tzy.fsf@assigned-by-dhcp.cox.net","subject":"Re: Please pull mergetool.git","fromName":"Brian Gernhardt","fromEmail":"benji@silverinsanity.com","sentAt":"2007-06-10T23:29:51Z","receivedAt":"2007-06-10T23:29:51Z","isPatch":false,"sender":{"key":"benji@silverinsanity.com","avatar":"https://gravatar.com/avatar/e06c101dbc25c68114d859b4a9ec7cf8a2c52fd2b0270ef0eac0e2e63ff22311?d=mp&s=160"},"body":"\nOn Jun 10, 2007, at 3:55 PM, Junio C Hamano wrote:\n\n> I do not see problems in the mergetool part, other than that I\n> mildly suspect that opendiff -- actually FileMerge -- might want\n> to be in the test -n \"$DISPLAY\" section, but that is inherited\n> from the previous iteration so in that sense leaving outside is\n> a sane thing to do.\n\nActually, opendiff (as FileMerge.app) is available under OS X, where  \n$DISPLAY is not set.\n\n~~ Brian\n"},{"id":"44681","messageId":"7vabv74838.fsf@assigned-by-dhcp.cox.net","threadId":"8541","inReplyTo":"26568045-F443-415E-A250-29C7DD3998A9@silverinsanity.com","subject":"Re: Please pull mergetool.git","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-11T01:02:03Z","receivedAt":"2007-06-11T01:02:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brian Gernhardt <benji@silverinsanity.com> writes:\n\n> On Jun 10, 2007, at 3:55 PM, Junio C Hamano wrote:\n>\n>> I do not see problems in the mergetool part, other than that I\n>> mildly suspect that opendiff -- actually FileMerge -- might want\n>> to be in the test -n \"$DISPLAY\" section, but that is inherited\n>> from the previous iteration so in that sense leaving outside is\n>> a sane thing to do.\n>\n> Actually, opendiff (as FileMerge.app) is available under OS X, where\n> $DISPLAY is not set.\n\nHeh, a graphical environment that does not use DISPLAY...\n\nThanks.\n"},{"id":"44685","messageId":"46a038f90706101855g639656f3qe80adeeb3a7d6dc2@mail.gmail.com","threadId":"8541","inReplyTo":"7vabv74838.fsf@assigned-by-dhcp.cox.net","subject":"Re: Please pull mergetool.git","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2007-06-11T01:55:25Z","receivedAt":"2007-06-11T01:55:25Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 6/11/07, Junio C Hamano <gitster@pobox.com> wrote:\n> Brian Gernhardt <benji@silverinsanity.com> writes:\n> > Actually, opendiff (as FileMerge.app) is available under OS X, where\n> > $DISPLAY is not set.\n>\n> Heh, a graphical environment that does not use DISPLAY...\n\nFWIW, it depends on whether you are using xterm (DISPLAY is set) or\nTerminal.app (DISPLAY may not be set). In any case FileMerge.app will\nignore DISPLAY.\n\ncheers,\n\n\nm\n"},{"id":"44722","messageId":"20070611133100.GB15117@thunk.org","threadId":"8541","inReplyTo":"46a038f90706101855g639656f3qe80adeeb3a7d6dc2@mail.gmail.com","subject":"Re: Please pull mergetool.git","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2007-06-11T13:31:00Z","receivedAt":"2007-06-11T13:31:00Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Mon, Jun 11, 2007 at 01:55:25PM +1200, Martin Langhoff wrote:\n> FWIW, it depends on whether you are using xterm (DISPLAY is set) or\n> Terminal.app (DISPLAY may not be set). In any case FileMerge.app will\n> ignore DISPLAY.\n\nIs there a reliable way on MacOS to determine whether the user is\nsitting in front of the terminal, as opposed to logged into the MacOS\nbox remotely?  Ideally we would only try opendiff/FileMerge.app if we\nnew that the user is indeed sitting in front of the graphical display.\n\n\t\t\t\t\t\t- Ted\n"}]}