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

Re: [PATCH 06/15] fetch: don't overlay config with submodule-config

From
Stefan Beller <sbeller@google.com>
Date
Jul 25, 2017, 23:44 UTC
Message-ID
<CAGZ79kZGFhiNAYqJ9hZqDLEZt-9jYQ=o0ej2VmO0E=pZg85Fsg@mail.gmail.com>
In-Reply-To
<20170725213928.125998-7-bmwill@google.com>
On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmwill@google.com> wrote:
Show 5 quoted lines
> Don't rely on overlaying the repository's config on top of the
> submodule-config, instead query the repository's config directly for the
> fetch_recurse field.
>
> Signed-off-by: Brandon Williams <bmwill@google.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Show 43 quoted lines
> ---
>  builtin/fetch.c |  1 -
>  submodule.c     | 24 +++++++++++++++++-------
>  2 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index d84c26391..3fe99073d 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -1362,7 +1362,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
>
>         if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
>                 gitmodules_config();
> -               git_config(submodule_config, NULL);
>         }
>
>         if (all) {
> diff --git a/submodule.c b/submodule.c
> index 8b9e48a61..c5058a4b8 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -1210,14 +1210,24 @@ static int get_next_submodule(struct child_process *cp,
>
>                 default_argv = "yes";
>                 if (spf->command_line_option == RECURSE_SUBMODULES_DEFAULT) {
> -                       if (submodule &&
> -                           submodule->fetch_recurse !=
> -                                               RECURSE_SUBMODULES_NONE) {
> -                               if (submodule->fetch_recurse ==
> -                                               RECURSE_SUBMODULES_OFF)
> +                       int fetch_recurse = RECURSE_SUBMODULES_NONE;
> +
> +                       if (submodule) {
> +                               char *key;
> +                               const char *value;
> +
> +                               fetch_recurse = submodule->fetch_recurse;
> +                               key = xstrfmt("submodule.%s.fetchRecurseSubmodules", submodule->name);
> +                               if (!repo_config_get_string_const(the_repository, key, &value)) {
> +                                       fetch_recurse = parse_fetch_recurse_submodules_arg(key, value);
> +                               }
> +                               free(key);
> +                       }

I wonder if it would be better to parse this in builtin/fetch.c#git_fetch_config and then pass it in here as a parameter, instead of looking it up directly here? That way it is easier to keep track of what a builtin pays attention to.

Show 13 quoted lines
> +
> +                       if (fetch_recurse != RECURSE_SUBMODULES_NONE) {
> +                               if (fetch_recurse == RECURSE_SUBMODULES_OFF)
>                                         continue;
> -                               if (submodule->fetch_recurse ==
> -                                               RECURSE_SUBMODULES_ON_DEMAND) {
> +                               if (fetch_recurse == RECURSE_SUBMODULES_ON_DEMAND) {
>                                         if (!unsorted_string_list_lookup(&changed_submodule_paths, ce->name))
>                                                 continue;
>                                         default_argv = "on-demand";
> --
> 2.14.0.rc0.400.g1c36432dff-goog
>
Previous: Brandon WilliamsNext: Brandon Williams
Message 24 of 61 in “submodule-config cleanup”
  1. 00/15 submodule-config cleanupBrandon Williams, Jul 25, 2017
  2. 02/15 submodule: don't use submodule_from_nameBrandon Williams, Jul 25, 2017
  3. Stefan BellerJul 25, 2017
  4. Junio C HamanoJul 26, 2017
  5. Jens LehmannJul 30, 2017
  6. Junio C HamanoJul 30, 2017
  7. Stefan BellerJul 31, 2017
  8. Heiko VoigtAug 11, 2017
  9. 04/15 submodule--helper: don't overlay config in remote_submodule_branchBrandon Williams, Jul 25, 2017
  10. Stefan BellerJul 25, 2017
  11. 05/15 submodule--helper: don't overlay config in update-cloneBrandon Williams, Jul 25, 2017
  12. Stefan BellerJul 25, 2017
  13. Brandon WilliamsJul 25, 2017
  14. 08/15 unpack-trees: don't rely on overlayed configBrandon Williams, Jul 25, 2017
  15. 09/15 submodule: remove submodule_config callback routineBrandon Williams, Jul 25, 2017
  16. Junio C HamanoJul 26, 2017
  17. 12/15 submodule-config: move submodule-config functions to submodule-config.cBrandon Williams, Jul 25, 2017
  18. 15/15 submodule: remove gitmodules_configBrandon Williams, Jul 25, 2017
  19. 14/15 unpack-trees: improve loading of .gitmodulesBrandon Williams, Jul 25, 2017
  20. 13/15 submodule-config: lazy-load a repository's .gitmodules fileBrandon Williams, Jul 25, 2017
  21. 11/15 submodule-config: remove support for overlaying repository configBrandon Williams, Jul 25, 2017
  22. 10/15 diff: stop allowing diff to have submodules configured in .git/configBrandon Williams, Jul 25, 2017
  23. 06/15 fetch: don't overlay config with submodule-configBrandon Williams, Jul 25, 2017
  24. Stefan BellerJul 25, 2017
  25. Brandon WilliamsJul 25, 2017
  26. 07/15 submodule: don't rely on overlayed config when setting diffoptsBrandon Williams, Jul 25, 2017
  27. Stefan BellerJul 25, 2017
  28. 01/15 t7411: check configuration parsing errorsBrandon Williams, Jul 25, 2017
  29. Junio C HamanoJul 26, 2017
  30. 03/15 add, reset: ensure submodules can be added or resetBrandon Williams, Jul 25, 2017
  31. Stefan BellerJul 25, 2017
  32. Brandon WilliamsJul 25, 2017
  33. Junio C HamanoJul 26, 2017
  34. Brandon WilliamsJul 31, 2017
  35. 00/15 submodule-config cleanupBrandon Williams, Aug 3, 2017
  36. 03/15 add, reset: ensure submodules can be added or resetBrandon Williams, Aug 3, 2017
  37. 05/15 submodule--helper: don't overlay config in update-cloneBrandon Williams, Aug 3, 2017
  38. 08/15 unpack-trees: don't respect submodule.updateBrandon Williams, Aug 3, 2017
  39. Stefan BellerAug 3, 2017
  40. Junio C HamanoAug 3, 2017
  41. Stefan BellerAug 3, 2017
  42. 07/15 submodule: don't rely on overlayed config when setting diffoptsBrandon Williams, Aug 3, 2017
  43. 09/15 submodule: remove submodule_config callback routineBrandon Williams, Aug 3, 2017
  44. 12/15 submodule-config: move submodule-config functions to submodule-config.cBrandon Williams, Aug 3, 2017
  45. 14/15 unpack-trees: improve loading of .gitmodulesBrandon Williams, Aug 3, 2017
  46. Heiko VoigtAug 11, 2017
  47. 15/15 submodule: remove gitmodules_configBrandon Williams, Aug 3, 2017
  48. 13/15 submodule-config: lazy-load a repository's .gitmodules fileBrandon Williams, Aug 3, 2017
  49. 10/15 diff: stop allowing diff to have submodules configured in .git/configBrandon Williams, Aug 3, 2017
  50. Junio C HamanoAug 3, 2017
  51. Brandon WilliamsAug 4, 2017
  52. 11/15 submodule-config: remove support for overlaying repository configBrandon Williams, Aug 3, 2017
  53. 06/15 fetch: don't overlay config with submodule-configBrandon Williams, Aug 3, 2017
  54. 04/15 submodule--helper: don't overlay config in remote_submodule_branchBrandon Williams, Aug 3, 2017
  55. 02/15 submodule: don't use submodule_from_nameBrandon Williams, Aug 3, 2017
  56. Stefan BellerAug 3, 2017
  57. Brandon WilliamsAug 4, 2017
  58. Heiko VoigtAug 11, 2017
  59. Junio C HamanoAug 3, 2017
  60. 01/15 t7411: check configuration parsing errorsBrandon Williams, Aug 3, 2017
  61. Junio C HamanoAug 3, 2017

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.