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"
> + fiThe 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?