git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/5] submodule-config: keep labels around

From
Stefan Beller <sbeller@google.com>
Date
Jan 23, 2016, 00:31 UTC
Message-ID
<1453509103-16470-4-git-send-email-sbeller@google.com>
In-Reply-To
<1453509103-16470-1-git-send-email-sbeller@google.com>
We need the submodule groups in a later patch.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 submodule-config.c | 15 +++++++++++++++
 submodule-config.h |  2 ++
 2 files changed, 17 insertions(+)
diff --git a/submodule-config.c b/submodule-config.c
index a32259e..245a0f6 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);
+	if (entry->config->labels) {
+		string_list_clear(entry->config->labels, 0);
+		free(entry->config->labels);
+	}
 	free(entry->config);
 }
 
@@ -184,6 +188,7 @@ static struct submodule *lookup_or_create_by_name(struct submodule_cache *cache,
 	submodule->update = NULL;
 	submodule->fetch_recurse = RECURSE_SUBMODULES_NONE;
 	submodule->ignore = NULL;
+	submodule->labels = NULL;
 
 	hashcpy(submodule->gitmodules_sha1, gitmodules_sha1);
 
@@ -324,6 +329,16 @@ static int parse_specific_submodule_config(const char *subsection, int subsectio
 			free((void *) submodule->update);
 			submodule->update = xstrdup(value);
 		}
+	} else if (!strcmp(key, "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);
+		}
 	}
 
 	return ret;
diff --git a/submodule-config.h b/submodule-config.h
index d9bbf9a..df73fd7 100644
--- a/submodule-config.h
+++ b/submodule-config.h
@@ -17,6 +17,8 @@ struct submodule {
 	const char *update;
 	/* 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.42.g77a36b9.dirty
Previous: Stefan BellerNext: Sebastian Schuberth
Message 4 of 14 in “[WAS: Submodule Groups] Labels and submodule.autoInitialize”
  1. 0/5 [WAS: Submodule Groups] Labels and submodule.autoInitializeStefan Beller, Jan 23, 2016
  2. 1/5 submodule init: Write submodule registration to stderrStefan Beller, Jan 23, 2016
  3. 2/5 git submodule: Teach add to label submodulesStefan Beller, Jan 23, 2016
  4. 3/5 submodule-config: keep labels aroundStefan Beller, Jan 23, 2016
  5. Sebastian SchuberthJan 24, 2016
  6. Stefan BellerJan 25, 2016
  7. 4/5 submodule update: respect submodule.autoInitializeStefan Beller, Jan 23, 2016
  8. 5/5 builtin/clone: Configure submodule.autoInitialize via --init-submoduleStefan Beller, Jan 23, 2016
  9. Jens LehmannJan 24, 2016
  10. Stefan BellerJan 25, 2016
  11. Jens LehmannJan 26, 2016
  12. Stefan BellerJan 26, 2016
  13. Jens LehmannJan 31, 2016
  14. Stefan BellerFeb 1, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.