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

Re: [PATCH] mergetool: support absolute paths to tools by git config merge.<tool>path

From
Steffen Prohaska <prohaska@zib.de>
Date
Oct 9, 2007, 06:30 UTC
Message-ID
<C52FC9BE-13EE-4CB7-A5E9-164A2AC0E2E7@zib.de>
In-Reply-To
<20071008215729.GC31713@thunk.org>
On Oct 8, 2007, at 11:57 PM, Theodore Tso wrote:
Show 22 quoted lines
> On Mon, Oct 08, 2007 at 11:22:40PM +0200, Steffen Prohaska wrote:
>> This commit adds a mechanism to provide absolute paths to the
>> commands called by 'git mergetool'. A path can be specified
>> in the configuation variable merge.<toolname>path.
>
> This patch doesn't work if the config file doesn't specify an explicit
> mergetool via merge.tool.   The reason for that is this loop:
>
>     for i in $merge_tool_candidates; do
>         if test $i = emerge ; then
>             cmd=emacs
>         else
>             cmd=$i
>         fi
>         if type $cmd > /dev/null 2>&1; then
>             merge_tool=$i
>             break
>         fi
>     done
>
> is only checking to see if $cmd is in the path; it's not looking up
> the merge.<toolname>path variable in this loop.

I didn't change the automatic detection. It should work as before. That is it continues to assume that merge tools are in PATH.

Is you expectation that git-mergetool should also consider the absolute paths provided in merge.<toolname>path?

When I wrote the patch I had in mind that people will set the merge.tool explicitly if they provide an absolute path. Automatic detection would only be used if nothing is configured. In this case a tool must be in PATH or would not be found.

Show 8 quoted lines
> I guess the other question is whether we would be better off simply
> telling the user to specify an absolute pathname in merge.tool, and
> then having git-mergetool strip off the directory path via basename,
> and then on window systems, stripping off the .EXE or .COM suffix, and
> then downcasing the name so that something like "C:\Program
> Files\ECMerge\ECMerge.exe" gets translated to "ecmerge".  Would I be
> right in guessing that the reason why you used merge.<toolname>path
> approach was to avoid this messy headache?

Yes. The program to start ECMerge on Windows is called 'guimerge.exe'. Hard to derive a sensible short name from this.

So I don't think that an automatic translation is an option. I prefer to provide the absolute paths.

Absolute paths have another advantage. You can set several of them and choose a tool on the command line. Maybe you have several tools you want to try. Or you hacking with someone else who preferes a different tool. Or you just want to give a demo. I see merge.<toolname>path more as a database associating absolute paths with the shortnames.

My mental model is as follows:
1) merge.tool selects the mechanism needed to call the tool, that is
command line arguments, how merge result is passed, ...
2) merge.<toolname>path provides additional information how to locate
the selected tool in the filesystem.
The two points are somewhat orthogonal. I'd not fuse them into one.
	Steffen
Previous: Theodore TsoNext: Frank Lichtenheld
Message 12 of 15 in “mergetool: support absolute paths to tools by git config merge.<tool>path”
  1. mergetool: support absolute paths to tools by git config merge.<tool>pathSteffen Prohaska, Oct 8, 2007
  2. mergetool: add support for ECMergeSteffen Prohaska, Oct 8, 2007
  3. Theodore TsoOct 8, 2007
  4. Steffen ProhaskaOct 9, 2007
  5. Johannes SchindelinOct 9, 2007
  6. Steffen ProhaskaOct 9, 2007
  7. Alan HadsellOct 9, 2007
  8. Steffen ProhaskaOct 9, 2007
  9. Alan HadsellOct 9, 2007
  10. Theodore TsoOct 8, 2007
  11. Theodore TsoOct 8, 2007
  12. Steffen ProhaskaOct 9, 2007
  13. Frank LichtenheldOct 8, 2007
  14. Steffen ProhaskaOct 9, 2007
  15. Johannes SchindelinOct 9, 2007

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.