git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Aguilar <davvid@gmail.com>
Cc: gitster@pobox.com, git@vger.kernel.org, charles@hashpling.org,
	markus.heidelberg@web.de
Subject: Re: [PATCH v5 14/14] difftool/mergetool: refactor commands to use git-mergetool--lib
Date: Wed, 08 Apr 2009 00:05:05 -0700	[thread overview]
Message-ID: <7vr603pqvy.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1239172085-23389-1-git-send-email-davvid@gmail.com> (David Aguilar's message of "Tue, 7 Apr 2009 23:28:05 -0700")

David Aguilar <davvid@gmail.com> writes:

> This consolidates the common functionality from git-mergetool and
> git-difftool--helper into a single git-mergetool--lib scriptlet.
>
> +guess_merge_tool () {
> +	tools="ecmerge"
> +	if merge_mode; then
> +		tools="tortoisemerge"
> +	else
> +		tools="kompare"
> +	fi

The first assignment of ecmerge seems a no-op.

> +	if test -n "$DISPLAY"; then
> +		if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
> +			tools="meld opendiff kdiff3 tkdiff xxdiff $tools \
> +				gvimdiff diffuse ecmerge"
> +		else
> +			tools="opendiff kdiff3 tkdiff xxdiff meld $tools \
> +				gvimdiff diffuse ecmerge"
> +		fi
> +	fi
> +	if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then
> +		# $EDITOR is emacs so add emerge as a candidate
> +		tools="$tools emerge vimdiff"
> +	elif echo "${VISUAL:-$EDITOR}" | grep vim > /dev/null 2>&1; then
> +		# $EDITOR is vim so add vimdiff as a candidate
> +		tools="$tools vimdiff emerge"
> +	else
> +		tools="$tools emerge vimdiff"
> +	fi
> +	tools="$(echo "$tools" | sed -e 's/ 	*/ /g')"
> +	echo >&2 "merge tool candidates: $tools"

Sorry, but I am not sure what this is doing.  Replace a SP followed by
zero or more HT with a single SP?  

Ahh, you are removing the HT in the indentation part?

I'd rather see the above written like this if that is the case:

> +	if test -n "$DISPLAY"; then
> +		if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
> +			tools="meld opendiff kdiff3 tkdiff xxdiff $tools"
> +		else
> +			tools="opendiff kdiff3 tkdiff xxdiff meld $tools"
> +		fi
> + 		tools="$tools gvimdiff diffuse ecmerge"
> +	fi

then you can lose the "echo | sed", no?

      reply	other threads:[~2009-04-08  7:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08  6:28 [PATCH v5 14/14] difftool/mergetool: refactor commands to use git-mergetool--lib David Aguilar
2009-04-08  7:05 ` Junio C Hamano [this message]

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=7vr603pqvy.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=charles@hashpling.org \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --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).