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

Re: [PATCH v3 2/2] Mark 'git cat-file' sparse-index compatible

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 3, 2024, 19:19 UTC
Message-ID
<xmqqle08ilzd.fsf@gitster.g>
In-Reply-To
<f4d1461b99350151970528e12a92290cb65f7860.1725386044.git.gitgitgadget@gmail.com>
"Kevin Lyles via GitGitGadget" <gitgitgadget@gmail.com> writes:
> Subject: Re: [PATCH v3 2/2] Mark 'git cat-file' sparse-index compatible
The same comment on the commit title applies here.
> From: Kevin Lyles <klyles+github@epic.com>
>
> This change affects how 'git cat-file' works with the index when

Again, we start by describing the status quo (e.g. "'git cat-file' always expands a sparse-index to a full index"), explaining why it is undesirable, and hinting what you want to do about it.

And then give an order to the codebase to "become like so".
Show 14 quoted lines
> diff --git a/builtin/cat-file.c b/builtin/cat-file.c
> index 18fe58d6b8b..1afdfb5cbae 100644
> --- a/builtin/cat-file.c
> +++ b/builtin/cat-file.c
> @@ -1047,6 +1047,9 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
>  	if (batch.buffer_output < 0)
>  		batch.buffer_output = batch.all_objects;
>  
> +	prepare_repo_settings(the_repository);
> +	the_repository->settings.command_requires_full_index = 0;
> +
>  	/* Return early if we're in batch mode? */
>  	if (batch.enabled) {
>  		if (opt_cw)

How should the correctness of a change line this validated, by the way? By following manually all the code paths from this point and making sure that the access to an element (or size) of the index that is sparsed out is preceded by a lazy rehydration of a tree that represents a subhierarchy in the sparse-index? Addition to end-to-end tests may increase the test coverage, but I am not sure how to ensure the coverage is exhaustive.

Thanks.
Previous: Kevin Lyles via GitGitGadgetNext: Kevin Lyles via GitGitGadget
Message 12 of 17 in “Mark `cat-file` sparse-index compatible”
  1. Mark `cat-file` sparse-index compatibleKevin Lyles via GitGitGadget, Aug 26, 2024
  2. Derrick StoleeAug 29, 2024
  3. 0/2 Mark cat-file sparse-index compatibleKevin Lyles via GitGitGadget, Aug 30, 2024
  4. 1/2 Allow using stdin in run_on_* functionsKevin Lyles via GitGitGadget, Aug 30, 2024
  5. 2/2 Mark 'git cat-file' sparse-index compatibleKevin Lyles via GitGitGadget, Aug 30, 2024
  6. Derrick StoleeSep 3, 2024
  7. Junio C HamanoSep 3, 2024
  8. 0/2 Mark 'git cat-file' sparse-index compatibleKevin Lyles via GitGitGadget, Sep 3, 2024
  9. 1/2 Allow using stdin in run_on_* functionsKevin Lyles via GitGitGadget, Sep 3, 2024
  10. Junio C HamanoSep 3, 2024
  11. 2/2 Mark 'git cat-file' sparse-index compatibleKevin Lyles via GitGitGadget, Sep 3, 2024
  12. Junio C HamanoSep 3, 2024
  13. 0/2 builtin/cat-file: mark 'git cat-file' sparse-index compatibleKevin Lyles via GitGitGadget, Sep 3, 2024
  14. 1/2 t1092: allow run_on_* functions to use standard inputKevin Lyles via GitGitGadget, Sep 3, 2024
  15. Junio C HamanoSep 4, 2024
  16. 2/2 builtin/cat-file: mark 'git cat-file' sparse-index compatibleKevin Lyles via GitGitGadget, Sep 3, 2024
  17. Junio C HamanoSep 4, 2024

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.