diff --git a/packfile.c b/packfile.c index fc2d7c2190..2023df1b75 100644 --- a/packfile.c +++ b/packfile.c @@ -1010,6 +1010,16 @@ void reprepare_packed_git(struct repository *r) struct object_directory *odb; obj_read_lock(); + + /* + * Reprepare alt odbs, in case the alternates file was modified + * during the course of this process. This only _adds_ odbs to + * the linked list, so existing odbs will continue to exist for + * the lifetime of the process. + */ + r->objects->loaded_alternates = 0; + prepare_alt_odb(r); + for (odb = r->objects->odb; odb; odb = odb->next) odb_clear_loose_cache(odb);