Skip to content

Commit 2bed2d4

Browse files
peffgitster
authored andcommitted
repack: simplify handling of --write-bitmap-index
We previously needed to pass --no-write-bitmap-index explicitly to pack-objects to override its reading of pack.writebitmaps from the config. Now that it no longer does so, we can assume that bitmaps are off by default, and only turn them on when necessary. This also lets us avoid a confusing tri-state flag for write_bitmaps. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15a906c commit 2bed2d4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

builtin/repack.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
static int delta_base_offset = 1;
1212
static int pack_kept_objects = -1;
13-
static int write_bitmaps = -1;
13+
static int write_bitmaps;
1414
static char *packdir, *packtmp;
1515

1616
static const char *const git_repack_usage[] = {
@@ -195,7 +195,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
195195
git_repack_usage, 0);
196196

197197
if (pack_kept_objects < 0)
198-
pack_kept_objects = write_bitmaps > 0;
198+
pack_kept_objects = write_bitmaps;
199199

200200
packdir = mkpathdup("%s/pack", get_object_directory());
201201
packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
@@ -221,9 +221,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
221221
argv_array_pushf(&cmd_args, "--no-reuse-delta");
222222
if (no_reuse_object)
223223
argv_array_pushf(&cmd_args, "--no-reuse-object");
224-
if (write_bitmaps >= 0)
225-
argv_array_pushf(&cmd_args, "--%swrite-bitmap-index",
226-
write_bitmaps ? "" : "no-");
224+
if (write_bitmaps)
225+
argv_array_push(&cmd_args, "--write-bitmap-index");
227226

228227
if (pack_everything & ALL_INTO_ONE) {
229228
get_non_kept_pack_filenames(&existing_packs);

0 commit comments

Comments
 (0)