Re: [PATCH v5 3/3] fetch --negotiate-only: do not update submodules
- From
Glen Choo <chooglen@google.com>
- Date
- Jan 18, 2022, 23:41 UTC
- Message-ID
- <kl6lpmooy5lq.fsf@chooglen-macbookpro.roam.corp.google.com>
- In-Reply-To
- <xmqqtue0r978.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 27 quoted lines
> Glen Choo <chooglen@google.com> writes:
>
>> + if (negotiate_only)
>> + switch (recurse_submodules_cli) {
>> + case RECURSE_SUBMODULES_OFF:
>> + case RECURSE_SUBMODULES_DEFAULT: {
>> + /*
>> + * --negotiate-only should never recurse into
>> + * submodules. Skip it by setting recurse_submodules to
>> + * RECURSE_SUBMODULES_OFF.
>> + */
>> + recurse_submodules = RECURSE_SUBMODULES_OFF;
>> + break;
>> + }
>> + default:
>> + die(_("--negotiate-only and --recurse-submodules cannot be used together"));
>> + }
>
> I think that this part has the only difference since the previous
> round, but I am puzzled about it. Everything else looks as good as
> the previous round was.
>
> I did not (and I do not) mind the block for the body of this if
> statement. Even though technically a single switch() statement
> makes a single statement block that does not need {} around, it is
> large enough that extra {} around (which you had in the previous
> round) may make it clear where the body begins and ends.Yes, that makes sense. This was why I added it initially.
Show 18 quoted lines
> But do we really need the extra block _inside_ the switch statement?
> IOW I would have expected to see this instead:
>
> switch (recurse_submodules_cli) {
> case RECURSE_SUBMODULES_OFF:
> case RECURSE_SUBMODULES_DEFAULT:
> /*
> * --negotiate-only should never recurse into
> * submodules. Skip it by setting recurse_submodules to
> * RECURSE_SUBMODULES_OFF.
> */
> recurse_submodules = RECURSE_SUBMODULES_OFF;
> break;
> default:
> die(_("--negotiate-only and --recurse-submodules cannot be used together"));
> }
>
> Thanks.Ah, I misunderstood. I'll blame the fact that I'm recovering from COVID ;) I'll remove the block from the "case".