Web lists-archives.com

Re: [PATCH v4] merge: refuse --commit with --squash




Vishal Verma <vishal@xxxxxxxxxx> writes:

> From: Vishal Verma <vishal@xxxxxxxxxx>
>
> Convert option_commit to tristate, representing the states of
> 'default/untouched', 'enabled-by-cli', 'disabled-by-cli'. With this in
> place, check whether option_commit was enabled by cli when squashing a
> merge. If so, error out, as this is not supported.
>
> Previously, when --squash was supplied, 'option_commit' was silently
> dropped. This could have been surprising to a user who tried to override
> the no-commit behavior of squash using --commit explicitly.
>
> Add a note to the --squash option for git-merge to clarify the
> incompatibility, and add a test case to t7600-merge.sh
>
> Cc: Junio C Hamano <gitster@xxxxxxxxx>
> Cc: Rafael Ascensão <rafa.almas@xxxxxxxxx>
> Cc: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
> Signed-off-by: Vishal Verma <vishal@xxxxxxxxxx>
> ---

I personally feel that "merge --squash --commit" that does not
complain and leaves the result in the working tree to be tweaked and
then committed is perfectly fine, especially given that the reason
why "--commit" option exists is primarily because we need to allow
"--no-commit" to stop the normal merge from recording the result in
a new commit.

A user who really wanted to record what a merge would bring to the
current state in a single-parent commit would have to do "git
commit" after that anyway, and with this patch, the user would
instead need to run the same "git merge" command again, without
"--commit", before being able to do so, so in the sense, it is
likely that this change makes it more cumbersome to use for such a
user to use the command. 

But I guess that this change will give an incentive to actually
allow the combination to "just work" by making it more obvious that
the combination is not supported, so it would be a slight
improvement in that sense ;-)