summaryrefslogtreecommitdiff
path: root/midx.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-09-09 13:53:06 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-09-09 13:53:06 -0700
commita31677dde39747700c0b626a9642315cd542cc73 (patch)
treebf0ee89019460610592dc23a1725dc61b6d8ec09 /midx.c
parentMerge branch 'ss/submodule-summary-in-c' (diff)
parentmidx: traverse the local MIDX first (diff)
downloadtgif-a31677dde39747700c0b626a9642315cd542cc73.tar.xz
Merge branch 'tb/repack-clearing-midx'
When a packfile is removed by "git repack", multi-pack-index gets cleared; the code was taught to do so less aggressively by first checking if the midx actually refers to a pack that no longer exists. * tb/repack-clearing-midx: midx: traverse the local MIDX first builtin/repack.c: invalidate MIDX only when necessary
Diffstat (limited to 'midx.c')
-rw-r--r--midx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/midx.c b/midx.c
index e9b2e1253a..cc19b66152 100644
--- a/midx.c
+++ b/midx.c
@@ -416,8 +416,12 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, i
m = load_multi_pack_index(object_dir, local);
if (m) {
- m->next = r->objects->multi_pack_index;
- r->objects->multi_pack_index = m;
+ struct multi_pack_index *mp = r->objects->multi_pack_index;
+ if (mp) {
+ m->next = mp->next;
+ mp->next = m;
+ } else
+ r->objects->multi_pack_index = m;
return 1;
}