diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-01-19 02:12:12 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-19 02:12:12 +0300 |
commit | cf417e2c1f50578d8f7eccb65b981042d05939f0 (patch) | |
tree | 0c72f5c975f754b32e38e08ff10f9f856ec8f343 /builtin | |
parent | 74f7427f8a7a6f8ac87e9f1bb1b140cd034f428d (diff) | |
parent | 1c409a705cb30ae3db6cdd48757c4a85f51456d4 (diff) |
Merge branch 'dt/disable-bitmap-in-auto-gc'
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()); |