Skip to content

Commit e704fc7

Browse files
peffgitster
authored andcommitted
pack-objects: introduce pack.allowPackReuse
Let's make it possible to configure if we want pack reuse or not. The main reason it might not be wanted is probably debugging and performance testing, though pack reuse _might_ cause larger packs, because we wouldn't consider the reused objects as bases for finding new deltas. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2f4af77 commit e704fc7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Documentation/config/pack.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ Note that changing the compression level will not automatically recompress
2727
all existing objects. You can force recompression by passing the -F option
2828
to linkgit:git-repack[1].
2929

30+
pack.allowPackReuse::
31+
When true, and when reachability bitmaps are enabled,
32+
pack-objects will try to send parts of the bitmapped packfile
33+
verbatim. This can reduce memory and CPU usage to serve fetches,
34+
but might result in sending a slightly larger pack. Defaults to
35+
true.
36+
3037
pack.island::
3138
An extended regular expression configuring a set of delta
3239
islands. See "DELTA ISLANDS" in linkgit:git-pack-objects[1]

builtin/pack-objects.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static off_t reuse_packfile_offset;
9696

9797
static int use_bitmap_index_default = 1;
9898
static int use_bitmap_index = -1;
99+
static int allow_pack_reuse = 1;
99100
static enum {
100101
WRITE_BITMAP_FALSE = 0,
101102
WRITE_BITMAP_QUIET,
@@ -2715,6 +2716,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
27152716
use_bitmap_index_default = git_config_bool(k, v);
27162717
return 0;
27172718
}
2719+
if (!strcmp(k, "pack.allowpackreuse")) {
2720+
allow_pack_reuse = git_config_bool(k, v);
2721+
return 0;
2722+
}
27182723
if (!strcmp(k, "pack.usesparse")) {
27192724
sparse = git_config_bool(k, v);
27202725
return 0;
@@ -3050,7 +3055,8 @@ static void loosen_unused_packed_objects(void)
30503055
*/
30513056
static int pack_options_allow_reuse(void)
30523057
{
3053-
return pack_to_stdout &&
3058+
return allow_pack_reuse &&
3059+
pack_to_stdout &&
30543060
allow_ofs_delta &&
30553061
!ignore_packed_keep_on_disk &&
30563062
!ignore_packed_keep_in_core &&

0 commit comments

Comments
 (0)