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

[PATCH v2 4/4] unpack-trees: take care to propagate the split-index flag

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 26, 2023, 22:45 UTC
Message-ID
<df61146eaf5bb6245f8607bacfb91ab5613e322a.1679870743.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1497.v2.git.1679870743.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

When copying the `split_index` structure from one index structure to another, we need to propagate the `SPLIT_INDEX_ORDERED` flag, too, if it is set, otherwise Git might forget to write the shared index when that is actually needed.

It just so _happens_ that in many instances when `unpack_trees()` is called, the result causes the shared index to be written anyway, but there are edge cases when that is not so.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 unpack-trees.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/unpack-trees.c b/unpack-trees.c
index 90b92114be8..ca5e47c77c0 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1916,6 +1916,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 		 * create a new one.
 		 */
 		o->result.split_index = o->src_index->split_index;
+		if (o->src_index->cache_changed & SPLIT_INDEX_ORDERED)
+			o->result.cache_changed |= SPLIT_INDEX_ORDERED;
 		o->result.split_index->refcount++;
 	} else {
 		o->result.split_index = init_split_index(&o->result);
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Jeff Hostetler
Message 17 of 19 in “Fix a few split-index bugs”
  1. 0/4 Fix a few split-index bugsJohannes Schindelin via GitGitGadget, Mar 22, 2023
  2. 1/4 split-index & fsmonitor: demonstrate a bugJohannes Schindelin via GitGitGadget, Mar 22, 2023
  3. Jeff HostetlerMar 23, 2023
  4. 2/4 split-index; stop abusing the `base_oid` to strip the "link" extensionJohannes Schindelin via GitGitGadget, Mar 22, 2023
  5. Junio C HamanoMar 22, 2023
  6. Jeff HostetlerMar 23, 2023
  7. Junio C HamanoMar 23, 2023
  8. Jeff HostetlerMar 23, 2023
  9. 3/4 fsmonitor: avoid overriding `cache_changed` bitsJohannes Schindelin via GitGitGadget, Mar 22, 2023
  10. 4/4 unpack-trees: take care to propagate the split-index flagJohannes Schindelin via GitGitGadget, Mar 22, 2023
  11. Jeff HostetlerMar 23, 2023
  12. Junio C HamanoMar 22, 2023
  13. 0/4 Fix a few split-index bugsJohannes Schindelin via GitGitGadget, Mar 26, 2023
  14. 3/4 fsmonitor: avoid overriding `cache_changed` bitsJohannes Schindelin via GitGitGadget, Mar 26, 2023
  15. 2/4 split-index; stop abusing the `base_oid` to strip the "link" extensionJohannes Schindelin via GitGitGadget, Mar 26, 2023
  16. 1/4 split-index & fsmonitor: demonstrate a bugJohannes Schindelin via GitGitGadget, Mar 26, 2023
  17. 4/4 unpack-trees: take care to propagate the split-index flagJohannes Schindelin via GitGitGadget, Mar 26, 2023
  18. Jeff HostetlerMar 27, 2023
  19. Junio C HamanoMar 27, 2023

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.