mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
multi-pack-index: verify missing pack
Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
8e72a3c321
commit
d4bf1d88b9
16
midx.c
16
midx.c
@ -926,13 +926,29 @@ void clear_midx_file(const char *object_dir)
|
||||
|
||||
static int verify_midx_error;
|
||||
|
||||
static void midx_report(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
verify_midx_error = 1;
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, "\n");
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int verify_midx_file(const char *object_dir)
|
||||
{
|
||||
uint32_t i;
|
||||
struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
|
||||
verify_midx_error = 0;
|
||||
|
||||
if (!m)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < m->num_packs; i++) {
|
||||
if (prepare_midx_pack(m, i))
|
||||
midx_report("failed to load pack in position %d", i);
|
||||
}
|
||||
|
||||
return verify_midx_error;
|
||||
}
|
||||
|
@ -222,6 +222,11 @@ test_expect_success 'verify packnames out of order' '
|
||||
"pack names out of order"
|
||||
'
|
||||
|
||||
test_expect_success 'verify packnames out of order' '
|
||||
corrupt_midx_and_verify $MIDX_BYTE_PACKNAME_ORDER "a" $objdir \
|
||||
"failed to load pack"
|
||||
'
|
||||
|
||||
test_expect_success 'repack removes multi-pack-index' '
|
||||
test_path_is_file $objdir/pack/multi-pack-index &&
|
||||
git repack -adf &&
|
||||
|
Loading…
Reference in New Issue
Block a user