# About -X<option>

8 messages from 2008-07-05 to 2008-07-06. Participants: Johannes Schindelin, Miklos Vajna, Pieter de Bie, Junio C Hamano.
Thread: https://gitlist.dev/t/14298

## Johannes Schindelin, 2008-07-05 12:57

Subject: About -X<option>
Message-ID: <alpine.DEB.1.00.0807051454060.3334@eeepc-johanness>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0807051454060.3334%40eeepc-johanness

```
Hi,

the -X<option> options are not really easy to convert to parseopt.  This 
is only one indication that the interface can be improved.

Another one: you are more likely wanting to pass backend-_specific_ 
options to git-merge.

So, how about using this syntax instead?

	git pull -s recursive,theirs

i.e. strategy terms consist of the strategy name, optionally followed by a 
comma separated list of backend options.

Hmm?

Ciao,
Dscho

```

## Miklos Vajna, 2008-07-05 13:32

Subject: Re: About -X<option>
Message-ID: <20080705133245.GH4729@genesis.frugalware.org>
URL: https://gitlist.dev/e/20080705133245.GH4729%40genesis.frugalware.org
In-Reply-To: <alpine.DEB.1.00.0807051454060.3334@eeepc-johanness>

```
On Sat, Jul 05, 2008 at 02:57:12PM +0200, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> So, how about using this syntax instead?
> 
> 	git pull -s recursive,theirs
> 
> i.e. strategy terms consist of the strategy name, optionally followed by a 
> comma separated list of backend options.

As a user I would think that it tells git-merge to first try 'recursive'
then 'theirs'.

Of course you can still say that users should read the documentation,
but... ;-)

```

## Pieter de Bie, 2008-07-05 13:48

Subject: Re: About -X<option>
Message-ID: <AB745D70-D23A-4742-A5B3-DC1B6CAD9C30@ai.rug.nl>
URL: https://gitlist.dev/e/AB745D70-D23A-4742-A5B3-DC1B6CAD9C30%40ai.rug.nl
In-Reply-To: <20080705133245.GH4729@genesis.frugalware.org>

```

On 5 jul 2008, at 15:32, Miklos Vajna wrote:

> As a user I would think that it tells git-merge to first try  
> 'recursive'
> then 'theirs'.
>

I agree with this. Perhaps there's an easy fix: how about a colon?

	git pull -s recursive:theirs

might be more intuitive?

```

## Junio C Hamano, 2008-07-05 17:40

Subject: Re: About -X<option>
Message-ID: <7v63rktekf.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v63rktekf.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <AB745D70-D23A-4742-A5B3-DC1B6CAD9C30@ai.rug.nl>

```
Pieter de Bie <frimmirf@gmail.com> writes:

> On 5 jul 2008, at 15:32, Miklos Vajna wrote:
>
>> As a user I would think that it tells git-merge to first try
>> 'recursive'
>> then 'theirs'.
>>
>
> I agree with this. Perhaps there's an easy fix: how about a colon?
>
> 	git pull -s recursive:theirs
>
> might be more intuitive?

How would you do the equivalent of

	git pull -s recursive -Xsubtree="My Playpen/" -Xours

with the syntax?

Note that the current scripted "pull" and "merge" has a limitation that it
does not allow $IFS in -X<option> but that is not a designed-in limitation
but purely comes from a lazy implementation .

Also I do not see why -X<option> is not easy with parseopt() as Dscho
claimed in the original message in this thread...

```

## Johannes Schindelin, 2008-07-06 01:44

Subject: Re: About -X<option>
Message-ID: <alpine.DEB.1.00.0807060342550.3557@eeepc-johanness>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0807060342550.3557%40eeepc-johanness
In-Reply-To: <7v63rktekf.fsf@gitster.siamese.dyndns.org>

```
Hi,

On Sat, 5 Jul 2008, Junio C Hamano wrote:

> Also I do not see why -X<option> is not easy with parseopt() as Dscho 
> claimed in the original message in this thread...

Isn't that obvious?  -X looks like a short option, but the rest of that 
string does not consist of aggregated short options.

Besides, it is extremely ugly a syntax.  Just like git-log's -S thing.

Ciao,
Dscho

```

## Junio C Hamano, 2008-07-06 04:57

Subject: Re: About -X<option>
Message-ID: <7vmykvpq2n.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vmykvpq2n.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.DEB.1.00.0807060342550.3557@eeepc-johanness>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Isn't that obvious?  -X looks like a short option, but the rest of that 
> string does not consist of aggregated short options.

Ah, I see.  Then the issue is not about "not easy to code" but about "not
being consistent".  We should care much more deeply about the latter.

We can change it to "--X<option>[=<value>]" and "-X option[=<value>]"; the
topic is still young, not even documented properly IIRC, and is not
scheduled for 'master' any time soon yet.

```

## Johannes Schindelin, 2008-07-06 11:28

Subject: Re: About -X<option>
Message-ID: <alpine.LSU.1.00.0807061315310.32725@wbgn129.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0807061315310.32725%40wbgn129.biozentrum.uni-wuerzburg.de
In-Reply-To: <7vmykvpq2n.fsf@gitster.siamese.dyndns.org>

```
Hi,

On Sat, 5 Jul 2008, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Isn't that obvious?  -X looks like a short option, but the rest of 
> > that string does not consist of aggregated short options.
> 
> Ah, I see.  Then the issue is not about "not easy to code" but about "not
> being consistent".

I never meant to say "easy to code".  I always meant "not possible with 
parseopt, without major -- and ugly -- surgery".

> We can change it to "--X<option>[=<value>]" and "-X option[=<value>]"; 
> the topic is still young, not even documented properly IIRC, and is not 
> scheduled for 'master' any time soon yet.

I feel that this is too limiting.  You really do not want to allow passing 
"theirs" to git-merge, when you only ask for stratgey "resolve", right?  
Because the "resolve" strategy never heard about "theirs".

To be frank, the semantics of "theirs" _wants_ to treat it as a strategy; 
just think of

	$ git merge -s ours -Xtheirs

Besides, I sincerely doubt that anybody will find the naming of "-X" 
intuitive.

But let's step back a little: "theirs" is most likely something we do not 
want to announce, since a careful review in case of merge conflicts should 
be performed in that case.

So we do not want official support for it.

And there comes in an aspect of the broader plan for the second half of 
Miklos' project: user-defined merge backends.

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.

If we feel like it, we could even accept a "git-merge-partially-theirs" 
into contrib/.

Ciao,
Dscho

```

## Junio C Hamano, 2008-07-06 19:25

Subject: Re: About -X<option>
Message-ID: <7vd4lqerx8.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd4lqerx8.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.LSU.1.00.0807061315310.32725@wbgn129.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> 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).

```
