We need the submodule update strategies in a later patch.

Signed-off-by: Stefan Beller <sbel...@google.com>
---
 submodule-config.c | 16 ++++++++++++++++
 submodule-config.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/submodule-config.c b/submodule-config.c
index 393de53..0298a60 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -194,6 +194,7 @@ static struct submodule *lookup_or_create_by_name(struct 
submodule_cache *cache,
 
        submodule->path = NULL;
        submodule->url = NULL;
+       submodule->update = NULL;
        submodule->fetch_recurse = RECURSE_SUBMODULES_NONE;
        submodule->ignore = NULL;
 
@@ -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:
diff --git a/submodule-config.h b/submodule-config.h
index 9061e4e..f9e2a29 100644
--- a/submodule-config.h
+++ b/submodule-config.h
@@ -14,6 +14,7 @@ struct submodule {
        const char *url;
        int fetch_recurse;
        const char *ignore;
+       const char *update;
        /* the sha1 blob id of the responsible .gitmodules file */
        unsigned char gitmodules_sha1[20];
 };
-- 
2.5.0.275.ge015d2a

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to