Re: [PATCHv9 1/6] submodule-config: keep update strategy around
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 9, 2016, 22:32 UTC
- Message-ID
- <xmqqfux11pm8.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1455051274-15256-2-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 13 quoted lines
> + else {
> + submodule->update_command = NULL;
> + if (!strcmp(value, "none"))
> + submodule->update = SM_UPDATE_NONE;
> + else if (!strcmp(value, "checkout"))
> + submodule->update = SM_UPDATE_CHECKOUT;
> + else if (!strcmp(value, "rebase"))
> + submodule->update = SM_UPDATE_REBASE;
> + else if (!strcmp(value, "merge"))
> + submodule->update = SM_UPDATE_MERGE;
> + else if (!skip_prefix(value, "!", &submodule->update_command))
> + die(_("invalid value for %s"), var);
> + }I think this "string to enum" parser can become a separate helper function in this patch, so that later patch can use it to parse the "--update" option in the update_clone() function.
That would solve the slight inconsistency we have seen
+ if ((pp->update && !strcmp(pp->update, "none")) || + (!pp->update && sub->update == SM_UPDATE_NONE)) {
in that patch.