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

Re: About -X<option>

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 6, 2008, 19:25 UTC
Message-ID
<7vd4lqerx8.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.LSU.1.00.0807061315310.32725@wbgn129.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 10 quoted lines
> By allowing users to put a script in their PATH (possibly resorting to "." 
> just for that script), named "git-merge-<mybackend>", the following 
> becomes possible:
>
> 	$ echo 'git merge-recursive --theirs "$@"' > ~/bin/git-merge-X
> 	$ chmod a+x ~/bin/git-merge-X
> 	$ git merge -s X
>
> This would be even more flexible than the "-X" option, and it would 
> properly keep "--theirs" out of our officially supported features.

The above "custom backend" is fine, and would be useful for _other_ things (That's why I invented "-s" option to "git-merge" to begin with). The sad part is that it does not have much to do with a solution about -X<option> issue.

Imagine you want to enhance the recursive strategy so that the user can tweak the similarity threashold used in the rename detection. You would want to pass the equilvalent of -M<similarity> to the strategy backend through "git merge". You could use millions of such custom merge backend to do so:

	$ echo 'git merge-recursive -M2 "$@"' >~/bin/git-merge-M2
	$ echo 'git merge-recursive -M4 "$@"' >~/bin/git-merge-M4
	$ echo 'git merge-recursive -M6 "$@"' >~/bin/git-merge-M6
	$ ... millions of these ...
        $ git merge -s M09

but that's not a solution. You are kuldging around the issue by punting and by not solving it (iow "I did not have forsight to allow passing options through git-merge, and as consequence, the users are forced to have canned set of options in their backend"). You have the same issue with "-Xsubtree=git-gui/", for example.

Being able to pick strategy backend is wonderful, and being able to define new ones is also wonderful. But that is unrelated to what we are discussing here. Don't confuse the issue.

I am not married to -X<option> notation. Perhaps we can borrow the way "gcc" does this, when allowing linker and assmebler options to be passed from the command line to the backend with -Wa,<option> and -Wl,<option>.

The issue being addressed with these notation is exactly the same as what we are discussing, and we can follow the same model. The intermediary (gcc and git-merge) does not have to fully understand what the option they are passing to the backend (assembler and merge-* strategy).

Previous: Johannes Schindelin
Message 8 of 8 in “About -X<option>”
  1. Johannes SchindelinJul 5, 2008
  2. Miklos VajnaJul 5, 2008
  3. Pieter de BieJul 5, 2008
  4. Junio C HamanoJul 5, 2008
  5. Johannes SchindelinJul 6, 2008
  6. Junio C HamanoJul 6, 2008
  7. Johannes SchindelinJul 6, 2008
  8. Junio C HamanoJul 6, 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.