All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: peff@peff.net, gitster@pobox.com, jrnieder@gmail.com,
	johannes.schindelin@gmail.com, Jens.Lehmann@web.de,
	ericsunshine@gmail.com, j6t@kdbg.org, hvoigt@hvoigt.net,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH 1/5] submodule-config: keep submodule groups around
Date: Tue, 24 Nov 2015 17:32:15 -0800	[thread overview]
Message-ID: <1448415139-23675-2-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <1448415139-23675-1-git-send-email-sbeller@google.com>

We need to query the groups in a later patch.

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

diff --git a/submodule-config.c b/submodule-config.c
index a32259e..f44ce20 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -60,6 +60,7 @@ static void free_one_config(struct submodule_entry *entry)
 {
 	free((void *) entry->config->path);
 	free((void *) entry->config->name);
+	free((void *) entry->config->groups);
 	free(entry->config);
 }
 
@@ -182,6 +183,8 @@ static struct submodule *lookup_or_create_by_name(struct submodule_cache *cache,
 	submodule->path = NULL;
 	submodule->url = NULL;
 	submodule->update = NULL;
+	submodule->groups = xmalloc(sizeof(*submodule->groups));
+	string_list_init(submodule->groups, 1);
 	submodule->fetch_recurse = RECURSE_SUBMODULES_NONE;
 	submodule->ignore = NULL;
 
@@ -324,6 +327,17 @@ static int parse_specific_submodule_config(const char *subsection, int subsectio
 			free((void *) submodule->update);
 			submodule->update = xstrdup(value);
 		}
+	} else if (!strcmp(key, "groups")) {
+		if (!value)
+			ret = config_error_nonbool(var);
+		else if (!me->overwrite && submodule->groups)
+			warn_multiple_config(me->commit_sha1, submodule->name,
+					     "groups");
+		else {
+			string_list_clear(submodule->groups, 0);
+			string_list_split(submodule->groups, value, ',', -1);
+			string_list_sort(submodule->groups);
+		}
 	}
 
 	return ret;
diff --git a/submodule-config.h b/submodule-config.h
index d9bbf9a..7fc21e1 100644
--- a/submodule-config.h
+++ b/submodule-config.h
@@ -3,6 +3,7 @@
 
 #include "hashmap.h"
 #include "strbuf.h"
+#include "string-list.h"
 
 /*
  * Submodule entry containing the information about a certain submodule
@@ -17,6 +18,7 @@ struct submodule {
 	const char *update;
 	/* the sha1 blob id of the responsible .gitmodules file */
 	unsigned char gitmodules_sha1[20];
+	struct string_list *groups;
 };
 
 int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);
-- 
2.6.1.261.g0d9c4c1

  reply	other threads:[~2015-11-25  1:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25  1:32 [RFC PATCH 0/5] Submodule Groups Stefan Beller
2015-11-25  1:32 ` Stefan Beller [this message]
2015-11-25  1:32 ` [PATCH 2/5] git submodule add can add a submodule with groups Stefan Beller
2015-11-25  1:32 ` [PATCH 3/5] git submodule init to pass on groups Stefan Beller
2015-11-25  1:32 ` [PATCH 4/5] submodule--helper: module_list and update-clone have --groups option Stefan Beller
2015-11-25  1:32 ` [PATCH 5/5] builtin/clone: support submodule groups Stefan Beller
2015-11-25 17:52   ` Jens Lehmann
2015-11-25 18:08     ` Stefan Beller
2015-11-25 19:50       ` Jens Lehmann
2015-11-25 20:03         ` Stefan Beller
2015-11-25 22:30           ` Jens Lehmann
2015-11-25 22:51             ` Stefan Beller
2015-11-26  0:31             ` [PATCHv2] " Stefan Beller
2015-11-26  0:33               ` Stefan Beller
2015-11-26  5:00               ` Trevor Saunders
2015-11-30 19:31                 ` Stefan Beller
2015-12-01  6:53                   ` Michael J Gruber
2015-12-01 18:58                     ` Stefan Beller
2015-11-25 17:35 ` [RFC PATCH 0/5] Submodule Groups Jens Lehmann
2015-11-25 18:00   ` Stefan Beller
2015-11-25 19:18     ` Jens Lehmann
2015-11-30 23:54       ` Stefan Beller
2015-12-01 22:06         ` Jens Lehmann
2015-11-25 17:50 ` Jens Lehmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448415139-23675-2-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --cc=ericsunshine@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.