git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 14/14] difftool/mergetool: refactor commands to use git-mergetool--lib

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2009, 07:05 UTC
Message-ID
<7vr603pqvy.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1239172085-23389-1-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 10 quoted lines
> 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.
Show 20 quoted lines
> +	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:
Show 8 quoted lines
> +	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?
Previous: David Aguilar
Message 2 of 2 in “difftool/mergetool: refactor commands to use git-mergetool--lib”
  1. 14/14 difftool/mergetool: refactor commands to use git-mergetool--libDavid Aguilar, Apr 8, 2009
  2. Junio C HamanoApr 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.