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

Re: [WIP/PATCH 1/9] submodule: prepare for recursive checkout of submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 3, 2014, 22:23 UTC
Message-ID
<xmqqha8fdeek.fsf@gitster.dls.corp.google.com>
In-Reply-To
<52EFF290.5090501@web.de>
Jens Lehmann <Jens.Lehmann@web.de> writes:
> This commit adds the functions and files needed for configuration,
Please just say "Add the functions and files needed for ...".
Show 6 quoted lines
> +++ b/Documentation/recurse-submodules-update.txt
> @@ -0,0 +1,8 @@
> +--[no-]recurse-submodules::
> +	Using --recurse-submodules will update the work tree of all
> +	initialized submodules according to the commit recorded in the
> +	superproject if their update configuration is set to checkout'. If
That single quote does not seem to be closing any matching quote.

The phrase "according to" feels a bit too fuzzy. Merging the commit to what is checked out is one possible implementation of "according to". Applying the diff between the commit and what is checked out to work tree is another. Resetting the work tree files to exactly match the commit would be yet another.

I think "update the work trees to the commit" (i.e. lose the "according") would be the closest to what you are trying to say here.

> +	local modifications in a submodule would be overwritten the checkout
> +	will fail unless forced. Without this option or with
> +	--no-recurse-submodules is, the work trees of submodules will not be
> +	updated, only the hash recorded in the superproject will be updated.

It is unclear what happens if their update configuration is set to something other than 'checkout'.

Show 17 quoted lines
> diff --git a/submodule.c b/submodule.c
> index 613857e..b3eb28d 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -382,6 +384,48 @@ int parse_fetch_recurse_submodules_arg(const char *opt, const char *arg)
> ...
> +int option_parse_update_submodules(const struct option *opt,
> +				   const char *arg, int unset)
> +{
> +	if (unset) {
> +		*(int *)opt->value = RECURSE_SUBMODULES_OFF;
> +	} else {
> +		if (arg)
> +			*(int *)opt->value = parse_update_recurse_submodules_arg(opt->long_name, arg);
> +		else
> +			*(int *)opt->value = RECURSE_SUBMODULES_ON;
> +	}
You can easily unnest to lose {}
    if (unset)
            value = off;
    else if (arg)
            value = parse...;
    else
            value = on;

Also I suspect that git_config_maybe_bool() natively knows how to handle arg==NULL, so

    if (unset)
	value = off;
    else
	value = parse...;
is sufficient?
Previous: Jens LehmannNext: Jens Lehmann
Message 8 of 35 in “What's cooking in git.git (Jan 2014, #01; Mon, 6)”
  1. Junio C HamanoJan 6, 2014
  2. Francesco PrettoJan 6, 2014
  3. Junio C HamanoJan 6, 2014
  4. Francesco PrettoJan 6, 2014
  5. Jens LehmannJan 7, 2014
  6. 0/9 v2 submodule recursive checkout]Jens Lehmann, Feb 3, 2014
  7. 1/9 submodule: prepare for recursive checkout of submodulesJens Lehmann, Feb 3, 2014
  8. Junio C HamanoFeb 3, 2014
  9. Jens LehmannFeb 7, 2014
  10. Jonathan NiederFeb 4, 2014
  11. Jens LehmannFeb 7, 2014
  12. 2/9 Teach reset the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  13. Junio C HamanoFeb 3, 2014
  14. Jens LehmannFeb 7, 2014
  15. 3/9 Teach checkout the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  16. Junio C HamanoFeb 3, 2014
  17. Jens LehmannFeb 7, 2014
  18. 4/9 Teach merge the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  19. Junio C HamanoFeb 3, 2014
  20. Jens LehmannFeb 7, 2014
  21. Junio C HamanoFeb 7, 2014
  22. W. Trevor KingFeb 7, 2014
  23. 5/9 Teach bisect--helper the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  24. 6/9 Teach bisect the --[no-]recurse-submodules optionJens Lehmann, Feb 3, 2014
  25. W. Trevor KingFeb 3, 2014
  26. Jens LehmannFeb 3, 2014
  27. 7/9 submodule: teach unpack_trees() to remove submodule contentsJens Lehmann, Feb 3, 2014
  28. W. Trevor KingFeb 3, 2014
  29. Jens LehmannFeb 7, 2014
  30. 8/9 submodule: teach unpack_trees() to repopulate submodulesJens Lehmann, Feb 3, 2014
  31. 9/9 submodule: teach unpack_trees() to update submodulesJens Lehmann, Feb 3, 2014
  32. W. Trevor KingFeb 3, 2014
  33. Jens LehmannFeb 7, 2014
  34. Duy NguyenFeb 4, 2014
  35. Jens LehmannFeb 7, 2014

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.