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
Junio C Hamano <gitster@pobox.com>
Date
Aug 3, 2017, 20:37 UTC
Message-ID
<xmqqpoccwfpl.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170803182000.179328-9-bmwill@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 7 quoted lines
> 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?

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?

Show 20 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.

Show 34 quoted lines
>  }
>  
>  static void reload_gitmodules_file(struct index_state *index,
> @@ -293,7 +282,6 @@ static void reload_gitmodules_file(struct index_state *index,
>  				submodule_free();
>  				checkout_entry(ce, state, NULL);
>  				gitmodules_config();
> -				git_config(submodule_config, NULL);
>  			} else
>  				break;
>  		}
> @@ -308,19 +296,9 @@ static void unlink_entry(const struct cache_entry *ce)
>  {
>  	const struct submodule *sub = submodule_from_ce(ce);
>  	if (sub) {
> -		switch (sub->update_strategy.type) {
> -		case SM_UPDATE_UNSPECIFIED:
> -		case SM_UPDATE_CHECKOUT:
> -		case SM_UPDATE_REBASE:
> -		case SM_UPDATE_MERGE:
> -			/* state.force is set at the caller. */
> -			submodule_move_head(ce->name, "HEAD", NULL,
> -					    SUBMODULE_MOVE_HEAD_FORCE);
> -			break;
> -		case SM_UPDATE_NONE:
> -		case SM_UPDATE_COMMAND:
> -			return; /* Do not touch the submodule. */
> -		}
> +		/* state.force is set at the caller. */
> +		submodule_move_head(ce->name, "HEAD", NULL,
> +				    SUBMODULE_MOVE_HEAD_FORCE);
>  	}
>  	if (!check_leading_path(ce->name, ce_namelen(ce)))
>  		return;
Previous: Stefan BellerNext: Stefan Beller
Message 40 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.