Thread (1 message) 1 message, 1 author, 2024-09-03

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

From: Junio C Hamano <hidden>
Date: 2024-09-03 19:19:21

"Kevin Lyles via GitGitGadget" [off-list ref] 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 <redacted>

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".
quoted hunk
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help