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

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

From
David Aguilar <davvid@gmail.com>
Date
Apr 7, 2009, 07:07 UTC
Message-ID
<20090407070745.GA3684@gmail.com>
In-Reply-To
<200904070137.17716.markus.heidelberg@web.de>
On  0, Markus Heidelberg <markus.heidelberg@web.de> wrote:
Show 75 quoted lines
> David Aguilar, 06.04.2009:
> > diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
> 
> > +run_merge_tool () {
> > +	base_present="$2"
> > +	if diff_mode; then
> > +		base_present="false"
> > +	fi
> > +	if test -z "$base_present"; then
> > +		base_present="true"
> > +	fi
> 
> The second if is never true, so isn't necessary. run_merge_tool() is
> called with $2 = true or false in mergetool and $2 = "" in difftool.
> 
> But I wonder, if it would be better to change the proceeding in the
> case-esac in the next hunk below:
> 
> Currently it is:
>     if $base_present
>         mergetool with base
>     else
>         if $merge_mode
>             mergetool without base
>         else
>             difftool
>         fi
>     fi
> 
> Maybe better:
>     if $merge_mode
>         if $base_present
>             mergetool with base
>         else
>             mergetool without base
>         fi
>     else
>         difftool
>     fi
> 
> Then the first if can vanish as well and $base_present doesn't have to
> be set to false in diff_mode.
> 
> And check_unchanged() doesn't have to be called in diff_mode any more,
> $status could be set to 0 by default and doesn't have to be touched when
> in diff_mode. Only in merge_mode git-mergetool has to know, whether the
> merge went fine.
> 
> Then it will be:
>     if $merge_mode
>         touch $BACKUP
>         if $base_present
>             mergetool with base
>         else
>             mergetool without base
>         fi
> 	check_unchanged
>     else
>         difftool
>     fi
> 
> or:
>     if $merge_mode
>         if $base_present
>             mergetool with base
>         else
>             mergetool without base
>         fi
> 	status=$?
>     else
>         difftool
>     fi
> 
> Sorry for coming so late with this.
> 
Nah, I like your suggestion much better.
Show 12 quoted lines
> > +	if echo "${VISUAL:-$EDITOR}" | grep emacs > /dev/null 2>&1; then
> > +		# $EDITOR is emacs so add emerge as a candidate
> > +		tools="$tools emerge opendiff vimdiff"
> > +	elif echo "${VISUAL:-$EDITOR}" | grep vim > /dev/null 2>&1; then
> > +		# $EDITOR is vim so add vimdiff as a candidate
> > +		tools="$tools vimdiff opendiff emerge"
> > +	else
> > +		tools="$tools opendiff emerge vimdiff"
> > +	fi
> 
> Why is opendiff here? I thought the graphical tools should go above.
> Doesn't have Mac OS $DISPLAY set?

Good catch.. Ahh.. shoot I broke the foo.<tool>.path test on Mac OS (no tkdiff to override there). I'll have to redo that to use test-tool.

-- 
	David
Previous: Markus Heidelberg
Message 3 of 3 in “difftool/mergetool: refactor commands to use git-mergetool--lib”
  1. 14/14 difftool/mergetool: refactor commands to use git-mergetool--libDavid Aguilar, Apr 6, 2009
  2. Markus HeidelbergApr 6, 2009
  3. David AguilarApr 7, 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.