diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-31 13:32:06 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-31 13:32:06 -0800 |
commit | 81037171a59db996e05b98878359362ead6029f9 (patch) | |
tree | 857bc58982cc30c418c38906f88894736dd0877f /builtin | |
parent | bb7c47a452ce4fa22d25da6a5e7684dbbf7033e2 (diff) | |
parent | 1c409a705cb30ae3db6cdd48757c4a85f51456d4 (diff) | |
download | git-81037171a59db996e05b98878359362ead6029f9.tar.gz |
Merge branch 'dt/disable-bitmap-in-auto-gc' into maint
It is natural that "git gc --auto" may not attempt to pack
everything into a single pack, and there is no point in warning
when the user has configured the system to use the pack bitmap,
leading to disabling further "gc".
* dt/disable-bitmap-in-auto-gc:
repack: die on incremental + write-bitmap-index
auto gc: don't write bitmaps for incremental repacks
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/gc.c | 9 | ||||
-rw-r--r-- | builtin/repack.c | 9 |
2 files changed, 17 insertions, 1 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 069950d0b4..331f219260 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -191,6 +191,11 @@ static void add_repack_all_option(void) } } +static void add_repack_incremental_option(void) +{ + argv_array_push(&repack, "--no-write-bitmap-index"); +} + static int need_to_gc(void) { /* @@ -208,7 +213,9 @@ static int need_to_gc(void) */ if (too_many_packs()) add_repack_all_option(); - else if (!too_many_loose_objects()) + else if (too_many_loose_objects()) + add_repack_incremental_option(); + else return 0; if (run_hook_le(NULL, "pre-auto-gc", NULL)) diff --git a/builtin/repack.c b/builtin/repack.c index 80dd06b4a2..677bc7c81a 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -18,6 +18,12 @@ static const char *const git_repack_usage[] = { NULL }; +static const char incremental_bitmap_conflict_error[] = N_( +"Incremental repacks are incompatible with bitmap indexes. Use\n" +"--no-write-bitmap-index or disable the pack.writebitmaps configuration." +); + + static int repack_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "repack.usedeltabaseoffset")) { @@ -206,6 +212,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix) if (pack_kept_objects < 0) pack_kept_objects = write_bitmaps; + if (write_bitmaps && !(pack_everything & ALL_INTO_ONE)) + die(_(incremental_bitmap_conflict_error)); + packdir = mkpathdup("%s/pack", get_object_directory()); packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid()); |