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

Re: [PATCHv2 4/5] unpack-trees: oneway_merge to update submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 2, 2018, 19:43 UTC
Message-ID
<xmqqbmichws2.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171227225705.73235-5-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 14 quoted lines
> diff --git a/unpack-trees.c b/unpack-trees.c
> index bf8b602901..ac59524a7f 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -2139,6 +2139,9 @@ int oneway_merge(const struct cache_entry * const *src,
>  			    ie_match_stat(o->src_index, old, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE))
>  				update |= CE_UPDATE;
>  		}
> +		if (S_ISGITLINK(old->ce_mode) && should_update_submodules() &&
> +		    !verify_uptodate(old, o))
> +			update |= CE_UPDATE;
>  		add_entry(o, old, update, 0);
>  		return 0;
>  	}

This is more sensible than the previous one that broke same() by unconditionally checking the working tree state, even when the machinery is told not to look at the working tree.

The code in the pre-context of this hunk, (i.e. the original one you are half-way mimicking), we realize that the original cache entry and the cache entry we are checking out are exactly the same and we overwrite when we know that the path in the working tree is dirty, and we are not told to "skip" that path in the working tree (i.e. sparse checkout). That happens only when we are told to o->update and o->reset.

Shouldn't we be setting the update bit only when o->update is in effect, just like we can see in the pre-context of this hunk? I do not know if we need to require o->reset and/or need to pay attention to the skip worktree bit in this new case.

Previous: Stefan BellerNext: Stefan Beller
Message 23 of 38 in “Fix --recurse-submodules for submodule worktree changes”
  1. 0/5 Fix --recurse-submodules for submodule worktree changesStefan Beller, Dec 19, 2017
  2. 1/5 t/lib-submodule-update.sh: clarify testStefan Beller, Dec 19, 2017
  3. 3/5 t/lib-submodule-update.sh: add new test for submodule internal changeStefan Beller, Dec 19, 2017
  4. Jonathan NiederDec 19, 2017
  5. Stefan BellerDec 19, 2017
  6. 2/5 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Dec 19, 2017
  7. Junio C HamanoDec 22, 2017
  8. Stefan BellerDec 27, 2017
  9. 4/5 unpack-trees: Fix same() for submodulesStefan Beller, Dec 19, 2017
  10. 5/5 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Dec 19, 2017
  11. Jonathan NiederDec 19, 2017
  12. Stefan BellerDec 19, 2017
  13. Jonathan NiederDec 19, 2017
  14. Jonathan NiederDec 20, 2017
  15. Stefan BellerDec 20, 2017
  16. Stefan BellerDec 20, 2017
  17. 0/5 Fix --recurse-submodules for submodule worktree changesStefan Beller, Dec 27, 2017
  18. 1/5 t/helper/test-lazy-name-hash: fix compilationStefan Beller, Dec 27, 2017
  19. 2/5 t/lib-submodule-update.sh: clarify testStefan Beller, Dec 27, 2017
  20. 3/5 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Dec 27, 2017
  21. 5/5 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Dec 27, 2017
  22. 4/5 unpack-trees: oneway_merge to update submodulesStefan Beller, Dec 27, 2017
  23. Junio C HamanoJan 2, 2018
  24. Stefan BellerJan 2, 2018
  25. 0/5 Fix --recurse-submodules for submodule worktree changesStefan Beller, Jan 3, 2018
  26. 1/5 t/helper/test-lazy-name-hash: fix compilationStefan Beller, Jan 3, 2018
  27. 2/5 t/lib-submodule-update.sh: clarify testStefan Beller, Jan 3, 2018
  28. 3/5 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Jan 3, 2018
  29. 5/5 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Jan 3, 2018
  30. 4/5 unpack-trees: oneway_merge to update submodulesStefan Beller, Jan 3, 2018
  31. Junio C HamanoJan 3, 2018
  32. Stefan BellerJan 3, 2018
  33. 0/4 Fix --recurse-submodules for submodule worktree changesStefan Beller, Jan 5, 2018
  34. 1/4 t/lib-submodule-update.sh: clarify testStefan Beller, Jan 5, 2018
  35. 2/4 t/lib-submodule-update.sh: Fix test ignoring ignored files in submodulesStefan Beller, Jan 5, 2018
  36. 3/4 unpack-trees: oneway_merge to update submodulesStefan Beller, Jan 5, 2018
  37. 4/4 submodule: submodule_move_head omits old argument in forced caseStefan Beller, Jan 5, 2018
  38. Junio C HamanoJan 9, 2018

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.