Subject: Re: [PATCH v5 2/3] pull: move default warning

From: Junio C Hamano <[email-masked]>
Date: Fri, 11 Dec 2020 16:00:34 -0800

Felipe Contreras <[email-masked]> writes:

>>  - correct the if() statement above, so that regardless of verbosity
>>    level, we can do _something_ common when the history does not
>>    fast-forward.  I.e.
>>
>>         if (rebase_unspecified && !opt_ff) {
>>                 if (opt_verbosity >= 0)
>>                         show_advice_pull_non_ff();
>>         }
>>
>> These would allow us to further turn the logic to
>>
>>         if (rebase_unspecified && !opt_ff) {
>>                 if (opt_verbosity >= 0 && advice_pull_non_ff)
>>                         show_advice_pull_non_ff();
>>                 die("not a fast-forward; must merge or rebase");
>>         }
>
> Should actually be something like:
>
>         if (rebase_unspecified && !can_ff)
>                 die("Not a fast-forward; must either merge or rebase");

The illustration I gave in the message you are responding to was
made in the context of patch 2/3; with patch 3/3 where can_ff
exists, it would not become like what you gave above.  It should
instead become

	if (rebase_unspecified && !opt_ff && !can_ff) {
		if (opt_verbosity >= 0 && advice_pull_non_ff)
			show_advice_pull_non_ff();
		die("not a fast-forward; must merge or rebase");
	}

i.e. when we can fast-forward, we do not trigger the "you must
specify rebase/merge" message, and we do not trigger the "not a
fast-forward" error.