Subject: Re: [PATCH v6 3/3] rebase: add a config option for --rebase-merges

From: Junio C Hamano <[email-masked]>
Date: Tue, 07 Mar 2023 10:32:08 -0800

Phillip Wood <[email-masked]> writes:

>> +rebase.rebaseMerges::
>> +	Whether and how to set the `--rebase-merges` option by default. Can
>> +	be `rebase-cousins`, `no-rebase-cousins`, or a boolean. Setting to
>> +	true is equivalent to `--rebase-merges` without an argument,
>
> This is a bit picky but how can rebase.rebaseMerges=true be equivalent
> to --rebase-merges without an argument when the behavior of
> --rebase-merges without an argument depends on the value of
> rebase.rebaseMerges?

True.  I think the configuration is meant to give (when set to
something other than Boolean) the default value to the option
"--rebase-merges" that is given without value, so setting to false
should be a no-op (a command line option would override it if given,
and if there is no command line option, --rebase-merges is not used
by default), setting it to a specific value between cousin choices
would give --rebase-merges=<value> unless --no-rebase-merges is
given, but setting it to true here makes the result undefined,
unless the built-in default between cousin choices is described
here.

"Setting to true is equivalent to setting to no-rebase-cousins" and
"Setting to false is a no-op but accepted only for completeness",
perhaps?

>> setting to
>> +	`rebase-cousins` or `no-rebase-cousins` is equivalent to
>> +	`--rebase-merges` with that value as its argument, and setting to false
>> +	is equivalent to `--no-rebase-merges`. Passing `--rebase-merges` on the
>> +	command line without an argument overrides a `rebase.rebaseMerges=false`
>> +	configuration, but the absence of a specific rebase-merges mode on the
>> +	command line does not counteract a specific mode set in the configuration.
>
> I may not agree the with the design choice but the documentation here
> and below is very clear about the behavior of --rebase-merges without
> an argument which is good.

Is it?  rebase.rebaseMerges=true does not give "a specific mode set
in the configuration", so it still is unclear what --rebase-merges
should do in that case.  Unless what it means to set it to true is
described, as you pointed out above, that is.

>> +`no-rebase-cousins`. If the mode is not specified on the command line or in
>> +the `rebase.rebaseMerges` config option, it defaults to `no-rebase-cousins`.

This side could describe what setting it to "true" means, but it is
a separate page so it would be more friendly to readers to cover it
on both pages.

> I think we need
>
> 	} else {
> 		opts->rebase_cousins = 0;
> 	}
>
> here. Otherwise if rebase.rebaseMerges is set twice we wont follow the
> usual "last config wins" convention. For example
>
> 	[rebase]
> 		rebaseMerges=rebase-cousins
> 		rebaseMerges=true
>
> will result in us unexpectedly rebasing cousins

Thanks for a careful review.