diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-09-09 13:53:06 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-09 13:53:06 -0700 |
commit | a31677dde39747700c0b626a9642315cd542cc73 (patch) | |
tree | bf0ee89019460610592dc23a1725dc61b6d8ec09 /midx.c | |
parent | Merge branch 'ss/submodule-summary-in-c' (diff) | |
parent | midx: traverse the local MIDX first (diff) | |
download | tgif-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } |