Skip to content

Commit 1c409a7

Browse files
novalisgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bdf56de commit 1c409a7

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

builtin/repack.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ static const char *const git_repack_usage[] = {
1818
NULL
1919
};
2020

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+
2127
static int repack_config(const char *var, const char *value, void *cb)
2228
{
2329
if (!strcmp(var, "repack.usedeltabaseoffset")) {
@@ -206,6 +212,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
206212
if (pack_kept_objects < 0)
207213
pack_kept_objects = write_bitmaps;
208214

215+
if (write_bitmaps && !(pack_everything & ALL_INTO_ONE))
216+
die(_(incremental_bitmap_conflict_error));
217+
209218
packdir = mkpathdup("%s/pack", get_object_directory());
210219
packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
211220

t/t5310-pack-bitmaps.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,10 @@ test_expect_success 'fetch (partial bitmap)' '
105105
test_cmp expect actual
106106
'
107107

108-
test_expect_success 'incremental repack cannot create bitmaps' '
108+
test_expect_success 'incremental repack fails when bitmaps are requested' '
109109
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
114112
'
115113

116114
test_expect_success 'incremental repack can disable bitmaps' '

0 commit comments

Comments
 (0)