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 <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Aug 20, 2018 at 16:51 UTC fe86c3beb5893edd4e5648dab8cca66d6cc2e77d
1 file changed +4 -3
packfile.c
+4 -3
@@ -820,9 +820,8 @@ static void prepare_pack(const char *full_name, size_t full_name_len,
820 struct packed_git *p;
821 size_t base_len = full_name_len;
822
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))) {
825 /* Don't reopen a pack we already have. */
826 for (p = data->r->objects->packed_git; p; p = p->next) {
827 size_t len;
@@ -842,6 +841,8 @@ static void prepare_pack(const char *full_name, size_t full_name_len,
841 if (!report_garbage)
842 return;
843
844 + if (!strcmp(file_name, "multi-pack-index"))
845 + return;
846 if (ends_with(file_name, ".idx") ||
847 ends_with(file_name, ".pack") ||
848 ends_with(file_name, ".bitmap") ||