git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Markus Heidelberg <markus.heidelberg@web.de>,
	Johannes Gilger <heipei@hackvalue.de>,
	David Aguilar <davvid@gmail.com>
Subject: [PATCH] contrib/difftool: Don't repeat merge tool candidates
Date: Sat, 31 Jan 2009 12:27:56 -0800	[thread overview]
Message-ID: <1233433676-21944-1-git-send-email-davvid@gmail.com> (raw)

git difftool listed some candidates for mergetools twice, depending on
the environment.

This slightly changes the behavior when both KDE_FULL_SESSION and
GNOME_DESKTOP_SESSION_ID are set at the same time; in such a case
meld is used in favor of kdiff3 (the old code favored kdiff3 in such a
case), but it should not matter in practice.

Signed-off-by: David Aguilar <davvid@gmail.com>
---

Hi Junio

This is based on top of Markus's kompare patch:
	"contrib/difftool: add support for Kompare"
	http://article.gmane.org/gmane.comp.version-control.git/107883

This syncs difftool up with the mergetool patch that's in 'next':
	"git mergetool: Don't repeat merge tool candidates"
	http://article.gmane.org/gmane.comp.version-control.git/106669


 contrib/difftool/git-difftool-helper |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
index 10632a3..db3af6a 100755
--- a/contrib/difftool/git-difftool-helper
+++ b/contrib/difftool/git-difftool-helper
@@ -181,31 +181,24 @@ fi
 
 # Try to guess an appropriate merge tool if no tool has been set.
 if test -z "$merge_tool"; then
-
 	# We have a $DISPLAY so try some common UNIX merge tools
 	if test -n "$DISPLAY"; then
-		merge_tool_candidates="kdiff3 kompare tkdiff xxdiff meld gvimdiff"
-		# If gnome then prefer meld
-		if test -n "$GNOME_DESKTOP_SESSION_ID"; then
-			merge_tool_candidates="meld $merge_tool_candidates"
-		fi
-		# If KDE then prefer kdiff3 or kompare
-		if test "$KDE_FULL_SESSION" = "true"; then
-			merge_tool_candidates="kdiff3 kompare $merge_tool_candidates"
+		# If gnome then prefer meld, otherwise, prefer kdiff3 or kompare
+		if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
+			merge_tool_candidates="meld kdiff3 kompare tkdiff xxdiff gvimdiff"
+		else
+			merge_tool_candidates="kdiff3 kompare tkdiff xxdiff meld gvimdiff"
 		fi
 	fi
-
-	# $EDITOR is emacs so add emerge as a candidate
 	if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
-		merge_tool_candidates="$merge_tool_candidates emerge"
+		# $EDITOR is emacs so add emerge as a candidate
+		merge_tool_candidates="$merge_tool_candidates emerge opendiff vimdiff"
+	elif echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
+		# $EDITOR is vim so add vimdiff as a candidate
+		merge_tool_candidates="$merge_tool_candidates vimdiff opendiff emerge"
+	else
+		merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
 	fi
-
-	# $EDITOR is vim so add vimdiff as a candidate
-	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"
 
 	# Loop over each candidate and stop when a valid merge tool is found.
-- 
1.6.1.2.253.ga34a

             reply	other threads:[~2009-01-31 20:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-31 20:27 David Aguilar [this message]
2009-02-01  1:35 ` [PATCH] contrib/difftool: Don't repeat merge tool candidates Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233433676-21944-1-git-send-email-davvid@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=heipei@hackvalue.de \
    --cc=markus.heidelberg@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).