Re: [PATCH v3 00/20] Sparse Index: Design, Format, Tests
From: Derrick Stolee <hidden>
Date: 2021-03-16 16:59:55
On 3/16/2021 12:42 PM, Derrick Stolee via GitGitGadget wrote:> Updates in V3
============= For this version, I took Ævar's latest patches and applied them to v2.31.0 and rebased this series on top. It uses his new "read_tree_at()" helper and the associated changes to the function pointer type.
Junio, I wanted to call your attention to this change in base. Here is the relevant part of the range-diff:
5: 399ddb0bad56 ! 5: 99292cdbaae4 sparse-index: implement ensure_full_index()
@@ sparse-index.c
+}
+
+static int add_path_to_index(const struct object_id *oid,
-+ struct strbuf *base, const char *path,
-+ unsigned int mode, int stage, void *context)
++ struct strbuf *base, const char *path,
++ unsigned int mode, void *context)
+{
+ struct index_state *istate = (struct index_state *)context;
+ struct cache_entry *ce;
@@ sparse-index.c
- /* intentionally left blank */
+ int i;
+ struct index_state *full;
++ struct strbuf base = STRBUF_INIT;
+
+ if (!istate || !istate->sparse_index)
+ return;
@@ sparse-index.c
+ ps.has_wildcard = 1;
+ ps.max_depth = -1;
+
-+ read_tree_recursive(istate->repo, tree,
-+ ce->name, strlen(ce->name),
-+ 0, &ps,
-+ add_path_to_index, full);
++ strbuf_setlen(&base, 0);
++ strbuf_add(&base, ce->name, strlen(ce->name));
++
++ read_tree_at(istate->repo, tree, &base, &ps,
++ add_path_to_index, full);
+
+ /* free directory entries. full entries are re-used */
+ discard_cache_entry(ce);
@@ sparse-index.c
+ istate->cache_nr = full->cache_nr;
+ istate->cache_alloc = full->cache_alloc;
+
++ strbuf_release(&base);
+ free(full);
+
+ trace2_region_leave("index", "ensure_full_index", istate->repo);Thanks, -Stolee