From: Stefan Beller <sbeller@google.com>
To: Jens.Lehmann@web.de, sschuberth@gmail.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [RFC_PATCHv4 2/7] submodule-config: keep labels around
Date: Mon, 21 Mar 2016 19:06:07 -0700 [thread overview]
Message-ID: <1458612372-10966-3-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <1458612372-10966-1-git-send-email-sbeller@google.com>
We need the submodule labels in a later patch.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
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
next prev parent reply other threads:[~2016-03-22 2:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 2:06 [RFC_PATCHv4 0/7] Git submodule labels Stefan Beller
2016-03-22 2:06 ` [RFC_PATCHv4 1/7] git submodule: teach `add` to label submodules Stefan Beller
2016-03-22 22:28 ` Junio C Hamano
2016-03-22 22:34 ` Junio C Hamano
2016-03-22 2:06 ` Stefan Beller [this message]
2016-03-22 2:06 ` [RFC_PATCHv4 3/7] submodule-config: add method to check for being labeled Stefan Beller
2016-03-22 22:30 ` Junio C Hamano
2016-03-23 21:05 ` Stefan Beller
2016-03-22 2:06 ` [RFC_PATCHv4 4/7] submodule init: redirect stdout to stderr Stefan Beller
2016-03-22 7:46 ` Sebastian Schuberth
2016-03-22 16:14 ` Junio C Hamano
2016-03-22 16:47 ` Stefan Beller
2016-03-22 16:56 ` Sebastian Schuberth
2016-03-22 17:15 ` Junio C Hamano
2016-03-22 2:06 ` [RFC_PATCHv4 5/7] submodule update: respect submodule.actionOnLabel Stefan Beller
2016-03-22 22:40 ` Junio C Hamano
2016-03-23 23:21 ` Stefan Beller
2016-03-24 0:13 ` Junio C Hamano
2016-03-24 19:54 ` Stefan Beller
2016-03-24 21:14 ` Junio C Hamano
2016-03-22 2:06 ` [RFC_PATCHv4 6/7] clone: allow specification of submodules to be cloned Stefan Beller
2016-03-22 2:06 ` [RFC_PATCHv4 7/7] WIP status/diff: respect submodule.actionOnLabel 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458612372-10966-3-git-send-email-sbeller@google.com \
--to=sbeller@google.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).