aboutsummaryrefslogtreecommitdiffstats
path: root/packfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-03-19 15:03:12 -0700
committerJunio C Hamano <gitster@pobox.com>2023-03-19 15:03:12 -0700
commit0717a424a723201c4b77da3638764c70819c3f63 (patch)
tree88c5542684465982e380ad07e180705ac749d2d5 /packfile.c
parent5c92a451be8050576aa271a82b00727278dc4642 (diff)
parente2d003dbedf05906c0cc22493a96124c94521973 (diff)
downloadgit-0717a424a723201c4b77da3638764c70819c3f63.tar.gz
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
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c10
1 files changed, 10 insertions, 0 deletions
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);