repack: die on incremental + write-bitmap-index

The bitmap index only works for single packs, so requesting an incremental repack with bitmap indexes makes no sense. Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Turner committed Dec 28, 2016 at 17:45 UTC 1c409a705cb30ae3db6cdd48757c4a85f51456d4
2 files changed +12 -5
builtin/repack.c
+9
@@ -18,6 +18,12 @@ static const char *const git_repack_usage[] = {
18 NULL
19 };
20
21 +static const char incremental_bitmap_conflict_error[] = N_(
22 +"Incremental repacks are incompatible with bitmap indexes. Use\n"
23 +"--no-write-bitmap-index or disable the pack.writebitmaps configuration."
24 +);
25 +
26 +
27 static int repack_config(const char *var, const char *value, void *cb)
28 {
29 if (!strcmp(var, "repack.usedeltabaseoffset")) {
@@ -206,6 +212,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
212 if (pack_kept_objects < 0)
213 pack_kept_objects = write_bitmaps;
214
215 + if (write_bitmaps && !(pack_everything & ALL_INTO_ONE))
216 + die(_(incremental_bitmap_conflict_error));
217 +
218 packdir = mkpathdup("%s/pack", get_object_directory());
219 packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
220
t/t5310-pack-bitmaps.sh
+3 -5
@@ -105,12 +105,10 @@ test_expect_success 'fetch (partial bitmap)' '
105 test_cmp expect actual
106 '
107
108 -test_expect_success 'incremental repack cannot create bitmaps' '
108 +test_expect_success 'incremental repack fails when bitmaps are requested' '
109 test_commit more-1 &&
110 - find .git/objects/pack -name "*.bitmap" >expect &&
111 - git repack -d &&
112 - find .git/objects/pack -name "*.bitmap" >actual &&
113 - test_cmp expect actual
110 + test_must_fail git repack -d 2>err &&
111 + test_i18ngrep "Incremental repacks are incompatible with bitmap" err
112 '
113
114 test_expect_success 'incremental repack can disable bitmaps' '