make the pack index version configurable
It is a good idea to use pack index version 2 all the time since it has proper protection against propagation of certain pack corruptions when repacking which is not possible with index version 1, as demonstrated in test t5302. Hence this config option. The default is still pack index version 1. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
3e4bb087a1
commit
4d00bda2aa
13
index-pack.c
13
index-pack.c
@ -683,6 +683,17 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
|
||||
}
|
||||
}
|
||||
|
||||
static int git_index_pack_config(const char *k, const char *v)
|
||||
{
|
||||
if (!strcmp(k, "pack.indexversion")) {
|
||||
pack_idx_default_version = git_config_int(k, v);
|
||||
if (pack_idx_default_version > 2)
|
||||
die("bad pack.indexversion=%d", pack_idx_default_version);
|
||||
return 0;
|
||||
}
|
||||
return git_default_config(k, v);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, fix_thin_pack = 0;
|
||||
@ -693,6 +704,8 @@ int main(int argc, char **argv)
|
||||
struct pack_idx_entry **idx_objects;
|
||||
unsigned char sha1[20];
|
||||
|
||||
git_config(git_index_pack_config);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
const char *arg = argv[i];
|
||||
|
||||
|
Reference in New Issue
Block a user