From: Eric Sunshine Date: Tue, 22 Sep 2015 00:56:49 GMT Subject: Re: [PATCHv3 09/13] submodule config: keep update strategy around Message-ID: In-Reply-To: <1442875159-13027-10-git-send-email-sbeller@google.com> On Mon, Sep 21, 2015 at 6:39 PM, Stefan Beller wrote: > We need the submodule update strategies in a later patch. > > Signed-off-by: Stefan Beller > --- > diff --git a/submodule-config.c b/submodule-config.c > @@ -326,6 +327,21 @@ static int parse_config(const char *var, const char *value, void *data) > free((void *) submodule->url); > strbuf_addstr(&url, value); > submodule->url = strbuf_detach(&url, NULL); > + } else if (!strcmp(item.buf, "update")) { > + struct strbuf update = STRBUF_INIT; > + if (!value) { > + ret = config_error_nonbool(var); > + goto release_return; > + } > + if (!me->overwrite && submodule->update != NULL) { > + warn_multiple_config(me->commit_sha1, submodule->name, > + "update"); > + goto release_return; > + } > + > + free((void *) submodule->update); > + strbuf_addstr(&update, value); > + submodule->update = strbuf_detach(&update, NULL); > } > > release_return: Why the complicated logic flow? Also, why is strbuf 'update' needed? I'd have expected to see something simpler, such as: } else if (!strcmp(item.buf, "update")) { if (!value) ret = config_error_nonbool(var); else if (!me->overwrite && ...) warn_multiple_config(...); else { free((void *)submodule->update); submodule->update = xstrdup(value); } }