Skip to content

Commit 25f3119

Browse files
committed
Merge branch 'jk/repack-pack-writebitmaps-config'
* jk/repack-pack-writebitmaps-config: t7700: drop explicit --no-pack-kept-objects from .keep test repack: introduce repack.writeBitmaps config option repack: simplify handling of --write-bitmap-index pack-objects: stop respecting pack.writebitmaps
2 parents b30adaa + 2d0174e commit 25f3119

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

Documentation/config.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,12 +1905,7 @@ pack.useBitmaps::
19051905
you are debugging pack bitmaps.
19061906

19071907
pack.writebitmaps::
1908-
When true, git will write a bitmap index when packing all
1909-
objects to disk (e.g., when `git repack -a` is run). This
1910-
index can speed up the "counting objects" phase of subsequent
1911-
packs created for clones and fetches, at the cost of some disk
1912-
space and extra time spent on the initial repack. Defaults to
1913-
false.
1908+
This is a deprecated synonym for `repack.writeBitmaps`.
19141909

19151910
pack.writeBitmapHashCache::
19161911
When true, git will include a "hash cache" section in the bitmap
@@ -2187,7 +2182,15 @@ repack.packKeptObjects::
21872182
`--pack-kept-objects` was passed. See linkgit:git-repack[1] for
21882183
details. Defaults to `false` normally, but `true` if a bitmap
21892184
index is being written (either via `--write-bitmap-index` or
2190-
`pack.writeBitmaps`).
2185+
`repack.writeBitmaps`).
2186+
2187+
repack.writeBitmaps::
2188+
When true, git will write a bitmap index when packing all
2189+
objects to disk (e.g., when `git repack -a` is run). This
2190+
index can speed up the "counting objects" phase of subsequent
2191+
packs created for clones and fetches, at the cost of some disk
2192+
space and extra time spent on the initial repack. Defaults to
2193+
false.
21912194

21922195
rerere.autoupdate::
21932196
When set to true, `git-rerere` updates the index with the

builtin/pack-objects.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,10 +2214,6 @@ static int git_pack_config(const char *k, const char *v, void *cb)
22142214
cache_max_small_delta_size = git_config_int(k, v);
22152215
return 0;
22162216
}
2217-
if (!strcmp(k, "pack.writebitmaps")) {
2218-
write_bitmap_index = git_config_bool(k, v);
2219-
return 0;
2220-
}
22212217
if (!strcmp(k, "pack.writebitmaphashcache")) {
22222218
if (git_config_bool(k, v))
22232219
write_bitmap_options |= BITMAP_OPT_HASH_CACHE;

builtin/repack.c

Lines changed: 6 additions & 6 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[] = {
@@ -28,7 +28,8 @@ static int repack_config(const char *var, const char *value, void *cb)
2828
pack_kept_objects = git_config_bool(var, value);
2929
return 0;
3030
}
31-
if (!strcmp(var, "pack.writebitmaps")) {
31+
if (!strcmp(var, "repack.writebitmaps") ||
32+
!strcmp(var, "pack.writebitmaps")) {
3233
write_bitmaps = git_config_bool(var, value);
3334
return 0;
3435
}
@@ -195,7 +196,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
195196
git_repack_usage, 0);
196197

197198
if (pack_kept_objects < 0)
198-
pack_kept_objects = write_bitmaps > 0;
199+
pack_kept_objects = write_bitmaps;
199200

200201
packdir = mkpathdup("%s/pack", get_object_directory());
201202
packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
@@ -221,9 +222,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
221222
argv_array_pushf(&cmd_args, "--no-reuse-delta");
222223
if (no_reuse_object)
223224
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-");
225+
if (write_bitmaps)
226+
argv_array_push(&cmd_args, "--write-bitmap-index");
227227

228228
if (pack_everything & ALL_INTO_ONE) {
229229
get_non_kept_pack_filenames(&existing_packs);

t/perf/p5310-pack-bitmaps.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ test_perf_large_repo
88
# note that we do everything through config,
99
# since we want to be able to compare bitmap-aware
1010
# git versus non-bitmap git
11+
#
12+
# We intentionally use the deprecated pack.writebitmaps
13+
# config so that we can test against older versions of git.
1114
test_expect_success 'setup bitmap config' '
1215
git config pack.writebitmaps true &&
1316
git config pack.writebitmaphashcache true

t/t5310-pack-bitmaps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test_expect_success 'setup repo with moderate-sized history' '
1818
git checkout master &&
1919
blob=$(echo tagged-blob | git hash-object -w --stdin) &&
2020
git tag tagged-blob $blob &&
21-
git config pack.writebitmaps true &&
21+
git config repack.writebitmaps true &&
2222
git config pack.writebitmaphashcache true
2323
'
2424

t/t7700-repack.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
2121
objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 |
2222
sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") &&
2323
mv pack-* .git/objects/pack/ &&
24-
git repack --no-pack-kept-objects -A -d -l &&
24+
git repack -A -d -l &&
2525
git prune-packed &&
2626
for p in .git/objects/pack/*.idx; do
2727
idx=$(basename $p)
@@ -53,7 +53,7 @@ test_expect_success 'writing bitmaps via command-line can duplicate .keep object
5353

5454
test_expect_success 'writing bitmaps via config can duplicate .keep objects' '
5555
# build on $objsha1, $packsha1, and .keep state from previous
56-
git -c pack.writebitmaps=true repack -Adl &&
56+
git -c repack.writebitmaps=true repack -Adl &&
5757
test_when_finished "found_duplicate_object=" &&
5858
for p in .git/objects/pack/*.idx; do
5959
idx=$(basename $p)

0 commit comments

Comments
 (0)