Skip to content

Commit fe86c3b

Browse files
derrickstoleegitster
authored andcommitted
midx: stop reporting garbage
When prepare_packed_git is called with the report_garbage method initialized, we report unexpected files in the objects directory as garbage. Stop reporting the multi-pack-index and the pack-files it covers as garbage. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c39b02a commit fe86c3b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packfile.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,8 @@ static void prepare_pack(const char *full_name, size_t full_name_len,
820820
struct packed_git *p;
821821
size_t base_len = full_name_len;
822822

823-
if (strip_suffix_mem(full_name, &base_len, ".idx")) {
824-
if (data->m && midx_contains_pack(data->m, file_name))
825-
return;
823+
if (strip_suffix_mem(full_name, &base_len, ".idx") &&
824+
!(data->m && midx_contains_pack(data->m, file_name))) {
826825
/* Don't reopen a pack we already have. */
827826
for (p = data->r->objects->packed_git; p; p = p->next) {
828827
size_t len;
@@ -842,6 +841,8 @@ static void prepare_pack(const char *full_name, size_t full_name_len,
842841
if (!report_garbage)
843842
return;
844843

844+
if (!strcmp(file_name, "multi-pack-index"))
845+
return;
845846
if (ends_with(file_name, ".idx") ||
846847
ends_with(file_name, ".pack") ||
847848
ends_with(file_name, ".bitmap") ||

0 commit comments

Comments
 (0)