We need the submodule labels in a later patch. Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- submodule-config.c | 18 +++++++++++++++++- submodule-config.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/submodule-config.c b/submodule-config.c index 9fa2269..7b48e59 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -60,6 +60,10 @@ static void free_one_config(struct submodule_entry *entry) free((void *) entry->config->path); free((void *) entry->config->name); free((void *) entry->config->update_strategy.command); + if (entry->config->labels) { + string_list_clear(entry->config->labels, 0); + free(entry->config->labels); + } free(entry->config); } @@ -199,6 +203,7 @@ static struct submodule *lookup_or_create_by_name(struct submodule_cache *cache, submodule->update_strategy.command = NULL; submodule->fetch_recurse = RECURSE_SUBMODULES_NONE; submodule->ignore = NULL; + submodule->labels = NULL; hashcpy(submodule->gitmodules_sha1, gitmodules_sha1); @@ -324,7 +329,18 @@ static int parse_config(const char *var, const char *value, void *data) else if (parse_submodule_update_strategy(value, &submodule->update_strategy) < 0) die(_("invalid value for %s"), var); - } + } else if (!strcmp(item.buf, "label")) { + if (!value) + ret = config_error_nonbool(var); + else { + if (!submodule->labels) { + submodule->labels = + xmalloc(sizeof(*submodule->labels)); + string_list_init(submodule->labels, 1); + } + string_list_insert(submodule->labels, value); + } + } strbuf_release(&name); strbuf_release(&item); diff --git a/submodule-config.h b/submodule-config.h index 092ebfc..8d61df3 100644 --- a/submodule-config.h +++ b/submodule-config.h @@ -18,6 +18,8 @@ struct submodule { struct submodule_update_strategy update_strategy; /* the sha1 blob id of the responsible .gitmodules file */ unsigned char gitmodules_sha1[20]; + /* sorted, not as on disk */ + struct string_list *labels; }; int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg); -- 2.7.0.rc0.45.g6b4c145 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html