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

[PATCH 07/12] submodule config: keep update strategy around

From
Stefan Beller <sbeller@google.com>
Date
Oct 16, 2015, 01:52 UTC
Message-ID
<1444960333-16003-8-git-send-email-sbeller@google.com>
In-Reply-To
<1444960333-16003-1-git-send-email-sbeller@google.com>
We need the submodule update strategies in a later patch.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 submodule-config.c | 11 +++++++++++
 submodule-config.h |  1 +
 2 files changed, 12 insertions(+)
diff --git a/submodule-config.c b/submodule-config.c
index 393de53..175bcbb 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,16 @@ 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")) {
+		if (!value)
+			ret = config_error_nonbool(var);
+		else if (!me->overwrite && submodule->update != NULL)
+			warn_multiple_config(me->commit_sha1, submodule->name,
+					     "update");
+		else {
+			free((void *)submodule->update);
+			submodule->update = xstrdup(value);
+		}
 	}
 
 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.277.gfdc362b.dirty
Previous: Stefan BellerNext: Stefan Beller
Message 16 of 21 in “[RFC PATCHv1 00/12] git submodule update in C with parallel cloning”
  1. Stefan BellerOct 16, 2015
  2. 01/12 git submodule update: Announce skipping submodules on stderrStefan Beller, Oct 16, 2015
  3. Junio C HamanoOct 16, 2015
  4. Stefan BellerOct 16, 2015
  5. 02/12 git submodule update: Announce uninitialized modules on stderrStefan Beller, Oct 16, 2015
  6. Junio C HamanoOct 16, 2015
  7. 03/12 git submodule update: Move branch calculation to where it's neededStefan Beller, Oct 16, 2015
  8. Junio C HamanoOct 16, 2015
  9. 04/12 git submodule update: Announce outcome of submodule operation to stderrStefan Beller, Oct 16, 2015
  10. 05/12 git submodule update: Use its own list implementation.Stefan Beller, Oct 16, 2015
  11. Junio C HamanoOct 16, 2015
  12. Stefan BellerOct 16, 2015
  13. 06/12 git submodule update: Handle unmerged submodules in CStefan Beller, Oct 16, 2015
  14. Junio C HamanoOct 20, 2015
  15. Stefan BellerOct 20, 2015
  16. 07/12 submodule config: keep update strategy aroundStefan Beller, Oct 16, 2015
  17. 08/12 git submodule update: check for "none" in CStefan Beller, Oct 16, 2015
  18. 09/12 git submodule update: Check url in CStefan Beller, Oct 16, 2015
  19. 10/12 git submodule update: Clone projects from within CStefan Beller, Oct 16, 2015
  20. 11/12 submodule--helper: Do not emit submodules to process directly.Stefan Beller, Oct 16, 2015
  21. 12/12 WIP/broken Clone all outstanding submodules in parallelStefan Beller, Oct 16, 2015

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.