Re: [PATCH v3 00/20] Sparse Index: Design, Format, Tests
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 16, 2021, 16:59 UTC
- Message-ID
- <1ac21589-24c8-d24b-bee3-6682aa76e434@gmail.com>
- In-Reply-To
- <pull.883.v3.git.1615912983.gitgitgadget@gmail.com>
On 3/16/2021 12:42 PM, Derrick Stolee via GitGitGadget wrote:> Updates in V3
Show 5 quoted lines
> ============= > > 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:
Show 44 quoted lines
> 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