From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org, gitster@pobox.com, Jens.Lehmann@web.de,
jrnieder@gmail.com, sschuberth@gmail.com
Cc: Stefan Beller <sbeller@google.com>
Subject: [PATCH 3/5] submodule-config: keep labels around
Date: Fri, 22 Jan 2016 16:31:41 -0800 [thread overview]
Message-ID: <1453509103-16470-4-git-send-email-sbeller@google.com> (raw)
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
next prev parent reply other threads:[~2016-01-23 0:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-23 0:31 [RFC/PATCH 0/5] [WAS: Submodule Groups] Labels and submodule.autoInitialize Stefan Beller
2016-01-23 0:31 ` [PATCH 1/5] submodule init: Write submodule registration to stderr Stefan Beller
2016-01-23 0:31 ` [PATCH 2/5] git submodule: Teach add to label submodules Stefan Beller
2016-01-23 0:31 ` Stefan Beller [this message]
2016-01-24 18:06 ` [PATCH 3/5] submodule-config: keep labels around Sebastian Schuberth
2016-01-25 18:06 ` Stefan Beller
2016-01-23 0:31 ` [PATCH 4/5] submodule update: respect submodule.autoInitialize Stefan Beller
2016-01-23 0:31 ` [PATCH 5/5] builtin/clone: Configure submodule.autoInitialize via --init-submodule Stefan Beller
2016-01-24 19:38 ` [RFC/PATCH 0/5] [WAS: Submodule Groups] Labels and submodule.autoInitialize Jens Lehmann
2016-01-25 18:59 ` Stefan Beller
2016-01-26 20:59 ` Jens Lehmann
2016-01-26 21:50 ` Stefan Beller
2016-01-31 21:09 ` Jens Lehmann
2016-02-01 20:21 ` Stefan Beller
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=1453509103-16470-4-git-send-email-sbeller@google.com \
--to=sbeller@google.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=sschuberth@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).