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

Re: How can a custom merge tool get access to file shell variables?

From
Charles Bailey <charles@hashpling.org>
Date
Aug 21, 2008, 22:15 UTC
Message-ID
<20080821221524.GA25429@hashpling.org>
In-Reply-To
<1219170751.12921.27.camel@kea-nicira-lt.nicira.com>
On Tue, Aug 19, 2008 at 11:32:31AM -0700, Keith Amidon wrote:
Show 18 quoted lines
> In case anyone is interested, the following does exactly what I want.
> Hopefully this example will help someone else that wants to do something
> similar avoid spending time on writing an unnecessary shell script
> wrapper tool.
> 
> [mergetool "xxdiff-2way-ignorews"]
>     cmd = xxdiff -w $REMOTE $LOCAL --merged-filename $MERGED
>     trustExitCode = false
> 
> I think I was thrown off by the description of mergetool.<name>.cmd in
> the git-config man page.  While on close reading it is definitely
> correct, for me at least it seemed natural to assume that the invoked
> command was supposed to get its information from the environment, not
> that the command line itself could substitute from the environment.
> Would an example such as the above in the man page might help direct
> people toward the best way to do this?
> 
>            --- Keith

Did you also try the git mergetool man page (not that it's much better!)?

The point of the custom mergetool patch was to make using a new, previously unknown merge tool a 'simple' configuration exercise rather than a patch or scripting exercise. At the time, an 'eval' approach was the compromise between ease of implementation and preventing environmental pollution.

It's not the most beautiful of solutions, especially since escaping quotes and spaces in either .gitconfig or in a git config command line of something that is later going to be expanded by the shell is something of a mind bender.

An example in the documentation would be a really good idea - you are not the first person to have asked about how to use the custom merge tool feature. I'm feeling a little guilty about not adding my name to the man page when I submitted the patch. It's not Ted's fault that the custom merge tool section is badly explained; it's mine.

-- 
Charles Bailey
http://ccgi.hashpling.plus.com/blog/
Previous: Keith AmidonNext: Keith Amidon
Message 3 of 4 in “How can a custom merge tool get access to file shell variables?”
  1. Keith AmidonAug 19, 2008
  2. Keith AmidonAug 19, 2008
  3. Charles BaileyAug 21, 2008
  4. Keith AmidonAug 21, 2008

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.