diff mbox series

[v3,10/26] fsck: ensure full index

Message ID 45b603379422bcf7382ff905a97921e3ca5114a3.1618261698.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 2227ea175f9d2660c66f1bf15e2cd1ad75c9d4ca
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee April 12, 2021, 9:08 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

When verifying all blobs reachable from the index, ensure that a sparse
index has been expanded to a full one to avoid missing some blobs.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 builtin/fsck.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/builtin/fsck.c b/builtin/fsck.c
index 821e7798c706..4d7f5c63ce0d 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -883,6 +883,8 @@  int cmd_fsck(int argc, const char **argv, const char *prefix)
 		verify_index_checksum = 1;
 		verify_ce_order = 1;
 		read_cache();
+		/* TODO: audit for interaction with sparse-index. */
+		ensure_full_index(&the_index);
 		for (i = 0; i < active_nr; i++) {
 			unsigned int mode;
 			struct blob *blob;