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

Re: [PATCH 06/12] git submodule update: Handle unmerged submodules in C

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 20, 2015, 21:11 UTC
Message-ID
<xmqqlhax6y9s.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1444960333-16003-7-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 19 quoted lines
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>  builtin/submodule--helper.c | 15 +++++++++++----
>  git-submodule.sh            |  6 +-----
>  2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 47dc9cb..f81f37a 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -284,11 +284,18 @@ static int module_list_or_clone(int argc, const char **argv, const char *prefix)
>  	for (i = 0; i < list.nr; i++) {
>  		const struct cache_entry *ce = list.entries[i];
>  
> -		if (ce_stage(ce))
> -			printf("%06o %s U\t", ce->ce_mode, sha1_to_hex(null_sha1));
> -		else
> -			printf("%06o %s %d\t", ce->ce_mode, sha1_to_hex(ce->sha1), ce_stage(ce));
> +		char *env_prefix = getenv("prefix");

This somehow makes me feel dirty. Do we really export such an environment variable that is named overly generically to communicate with our own helpers?

I can see why you need to be able to prefix leading paths (i.e. you would need to prefix path to the enclosing submodule to a path to obtain the "global view" from the very top-level superproject while recursing into nested submodules), but still...

Show 31 quoted lines
> +		if (ce_stage(ce)) {
> +			if (env_prefix)
> +				fprintf(stderr, "Skipping unmerged submodule %s/%s",
> +					env_prefix, ce->name);
> +			else
> +				fprintf(stderr, "Skipping unmerged submodule %s",
> +					ce->name);
> +			continue;
> +		}
>  
> +		printf("%06o %s %d\t", ce->ce_mode, sha1_to_hex(ce->sha1), ce_stage(ce));
>  		utf8_fprintf(stdout, "%s\n", ce->name);
>  	}
>  	return 0;
> diff --git a/git-submodule.sh b/git-submodule.sh
> index d2d80e2..0754ecd 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -661,11 +661,7 @@ cmd_update()
>  	while read mode sha1 stage sm_path
>  	do
>  		die_if_unmatched "$mode"
> -		if test "$stage" = U
> -		then
> -			echo >&2 "Skipping unmerged submodule $prefix$sm_path"
> -			continue
> -		fi
> +
>  		name=$(git submodule--helper name "$sm_path") || exit
>  		url=$(git config submodule."$name".url)
>  		if ! test -z "$update"
Previous: Stefan BellerNext: Stefan Beller
Message 14 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.