All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, Jens.Lehmann@web.de, jrnieder@gmail.com
Subject: Re: [PATCH 2/4] submodule-config: keep groups around
Date: Wed, 20 Jan 2016 13:23:16 -0800	[thread overview]
Message-ID: <xmqqwpr43pyz.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1453260880-628-3-git-send-email-sbeller@google.com> (Stefan Beller's message of "Tue, 19 Jan 2016 19:34:38 -0800")

Stefan Beller <sbeller@google.com> writes:

> We need the submodule groups in a later patch.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  submodule-config.c | 13 +++++++++++++
>  submodule-config.h |  1 +
>  2 files changed, 14 insertions(+)
>
> diff --git a/submodule-config.c b/submodule-config.c
> index a32259e..b5453d0 100644
> --- a/submodule-config.c
> +++ b/submodule-config.c
> @@ -60,6 +60,8 @@ static void free_one_config(struct submodule_entry *entry)
>  {
>  	free((void *) entry->config->path);
>  	free((void *) entry->config->name);
> +	if (entry->config->groups)
> +		string_list_clear(entry->config->groups, 0);

You are allocating entry->config->groups itself in the in the hunk
around ll.327, so that also need to be freed, I would think.

>  	free(entry->config);
>  }
>  
> @@ -184,6 +186,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->groups = NULL;
>  
>  	hashcpy(submodule->gitmodules_sha1, gitmodules_sha1);
>  
> @@ -324,6 +327,16 @@ static int parse_specific_submodule_config(const char *subsection, int subsectio
>  			free((void *) submodule->update);
>  			submodule->update = xstrdup(value);
>  		}
> +	} else if (!strcmp(key, "group")) {
> +		if (!value)
> +			ret = config_error_nonbool(var);
> +		else {
> +			if (!submodule->groups) {
> +				submodule->groups = xmalloc(sizeof(*submodule->groups));
> +				string_list_init(submodule->groups, 1);
> +			}
> +			string_list_insert(submodule->groups, value);
> +		}
>  	}
>  
>  	return ret;
> diff --git a/submodule-config.h b/submodule-config.h
> index d9bbf9a..332f5be 100644
> --- a/submodule-config.h
> +++ b/submodule-config.h
> @@ -17,6 +17,7 @@ struct submodule {
>  	const char *update;
>  	/* the sha1 blob id of the responsible .gitmodules file */
>  	unsigned char gitmodules_sha1[20];
> +	struct string_list *groups;
>  };

Is there a case where you need to enumerate and show the groups a
submodule belongs to to the end users?  Using string_list_insert()
to manage this list would mean you will lose the original ordering
you saw the list of groups in their .gitmodules files, which may or
may not matter.  I'd assume that the ordering should not matter, but
that is something the user may want to see documented.

>  
>  int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg);

  reply	other threads:[~2016-01-20 21:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20  3:34 [PATCH 0/4] Submodule Groups Stefan Beller
2016-01-20  3:34 ` [PATCH 1/4] git submodule: Teach add to accept --group Stefan Beller
2016-01-20 21:18   ` Junio C Hamano
2016-01-20 23:57     ` Stefan Beller
2016-01-21  0:08       ` Junio C Hamano
2016-01-21  0:16         ` Stefan Beller
2016-01-21  4:45           ` Junio C Hamano
2016-01-20  3:34 ` [PATCH 2/4] submodule-config: keep groups around Stefan Beller
2016-01-20 21:23   ` Junio C Hamano [this message]
2016-01-21  0:20     ` Stefan Beller
2016-01-21  2:37       ` Junio C Hamano
2016-01-20  3:34 ` [PATCH 3/4] submodule update: Initialize all group-selected submodules by default Stefan Beller
2016-01-20 21:30   ` Junio C Hamano
2016-01-21  1:44     ` Stefan Beller
2016-01-21  4:40       ` Junio C Hamano
2016-01-21 19:39         ` Stefan Beller
2016-01-21 20:47           ` Junio C Hamano
2016-01-21 20:57             ` Junio C Hamano
2016-01-20  3:34 ` [PATCH 4/4] builtin/clone: support submodule groups Stefan Beller
2016-01-20 21:43   ` Junio C Hamano
2016-01-21 21:17 ` [PATCH 0/4] Submodule Groups Sebastian Schuberth
2016-01-21 21:56   ` Stefan Beller
2016-01-21 22:18     ` Junio C Hamano
2016-01-21 22:25       ` Junio C Hamano
2016-01-21 22:30       ` Stefan Beller
2016-01-21 22:37         ` Junio C Hamano
2016-01-22  8:55     ` Sebastian Schuberth

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=xmqqwpr43pyz.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=sbeller@google.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 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.