summaryrefslogtreecommitdiff
path: root/pack-revindex.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-08-22 19:45:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-08-23 05:00:22 (GMT)
commit4b480c6716a7d8e20e7e510827ea81e7939f335a (patch)
tree24c1de905aecbdebfd1c71485de456d0d6660c31 /pack-revindex.c
parenta81892dd8c37b6f13793739721b520fee3ce4c2c (diff)
downloadgit-4b480c6716a7d8e20e7e510827ea81e7939f335a.zip
git-4b480c6716a7d8e20e7e510827ea81e7939f335a.tar.gz
git-4b480c6716a7d8e20e7e510827ea81e7939f335a.tar.bz2
discard revindex data when pack list changes
This is needed to fix verify-pack -v with multiple pack arguments. Also, in theory, revindex data (if any) must be discarded whenever reprepare_packed_git() is called. In practice this is hard to trigger though. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-revindex.c')
-rw-r--r--pack-revindex.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pack-revindex.c b/pack-revindex.c
index cd300bd..6096b62 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -142,3 +142,15 @@ struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs)
} while (lo < hi);
die("internal error: pack revindex corrupt");
}
+
+void discard_revindex(void)
+{
+ if (pack_revindex_hashsz) {
+ int i;
+ for (i = 0; i < pack_revindex_hashsz; i++)
+ if (pack_revindex[i].revindex)
+ free(pack_revindex[i].revindex);
+ free(pack_revindex);
+ pack_revindex_hashsz = 0;
+ }
+}