Merge branch 'ds/reprepare-alternates-when-repreparing-packfiles'

Once we start running, we assumed that the list of alternate object
databases would never change.  Hook into the machinery used to
update the list of packfiles during runtime to update this list as
well.

* ds/reprepare-alternates-when-repreparing-packfiles:
  object-file: reprepare alternates when necessary
This commit is contained in:
Junio C Hamano 2023-03-19 15:03:12 -07:00
commit 0717a424a7

View File

@ -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);