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

Re: [PATCH v2 08/15] unpack-trees: don't respect submodule.update

From
Stefan Beller <sbeller@google.com>
Date
Aug 3, 2017, 20:43 UTC
Message-ID
<CAGZ79ka8YeW0ChP3Z3xjfV0r0aqg2sGpLDU5m5LGWyG9QED0Uw@mail.gmail.com>
In-Reply-To
<xmqqpoccwfpl.fsf@gitster.mtv.corp.google.com>
On Thu, Aug 3, 2017 at 1:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Brandon Williams <bmwill@google.com> writes:
>
>> The 'submodule.update' config was historically used and respected by the
>> 'submodule update' command because update handled a variety of different
>> ways it updated a submodule.  As we begin teaching other commands about
>> submodules it makes more sense for the different settings of
>> 'submodule.update' to be handled by the individual commands themselves
>> (checkout, rebase, merge, etc) so it shouldn't be respected by the
>> native checkout command.
>
> Soooo... what's the externally observable effect of this change?  Is
> it something that can be illustrated in a set of new tests?
The illustration can be as follows
    git config submodule.NAME.update none
    git checkout -f --recurse-submodules HEAD
    git status
    # observe dirty submodule, which is
    # not what checkout -f promises
Show 6 quoted lines
> IOW does this commit by itself want to change the behaviour of
> "submodule update" and existing (indirect) users of unpack-trees?
> Or does it want to keep the documented behaviour of "submodule
> update" while correcting unintended triggering in other (indirect)
> users of unpack-trees of the same machinery that is being removed in
> this patch?

"submodule update" is unaffected, only the recently introduced submodule awareness of checkout/reset/read-tree are changed.

This option is documented as
    submodule.<name>.update
    The default update procedure for a submodule. This variable is
    populated by git submodule init from the gitmodules(5) file. See
    description of update command in git-submodule(1).

which doesn't indicate that any other command apart from "submodule update" should respect it.

Show 28 quoted lines
>
>> -     switch (sub->update_strategy.type) {
>> -     case SM_UPDATE_UNSPECIFIED:
>> -     case SM_UPDATE_CHECKOUT:
>> -             if (submodule_move_head(ce->name, old_id, new_id, flags))
>> -                     return o->gently ? -1 :
>> -                             add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
>> -             return 0;
>> -     case SM_UPDATE_NONE:
>> -             return 0;
>> -     case SM_UPDATE_REBASE:
>> -     case SM_UPDATE_MERGE:
>> -     case SM_UPDATE_COMMAND:
>> -     default:
>> -             warning(_("submodule update strategy not supported for submodule '%s'"), ce->name);
>> -             return -1;
>> -     }
>> +     if (submodule_move_head(ce->name, old_id, new_id, flags))
>> +             return o->gently ? -1 :
>> +                                add_rejected_path(o, ERROR_WOULD_LOSE_SUBMODULE, ce->name);
>> +     return 0;
>
> With this update, we always behave as if update_strategy.type were
> either left unspecified or explicitly set to checkout.  Other arms
> in this switch (and the other switch too), especially "none", were
> not expecting a call to submodule_move_head() to be made, but now
> the call is unconditional.
>

Yes. This is because each command (reset/checkout) should provide one expected behavior. It is not that we can configure reset to omit certain (tracked) files from being reset?

Previous: Junio C HamanoNext: Brandon Williams
Message 41 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.