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>
#include "builtin.h"
#include "cache.h"
#include "pack.h"
-
+#include "pack-revindex.h"
#define MAX_CHAIN 50
else {
if (verify_one_pack(argv[1], verbose))
err = 1;
+ discard_revindex();
nothing_done = 0;
}
argc--; argv++;
} 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;
+ }
+}
};
struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs);
+void discard_revindex(void);
#endif
void reprepare_packed_git(void)
{
+ discard_revindex();
prepare_packed_git_run_once = 0;
prepare_packed_git();
}
test-2-${packname_2}.idx \
test-3-${packname_3}.idx'
+test_expect_success \
+ 'verify pack -v' \
+ 'git verify-pack -v test-1-${packname_1}.idx \
+ test-2-${packname_2}.idx \
+ test-3-${packname_3}.idx'
+
test_expect_success \
'verify-pack catches mismatched .idx and .pack files' \
'cat test-1-${packname_1}.idx >test-3.idx &&