@matheusbsbs / matheus-bagliano / commits / e704fc7978
Fork 0

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 <peff@peff.net> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 18, 2019 at 12:25 UTC e704fc7978f2818f6a4cbf95bd0b75acf7b82aca
2 files changed +14 -1
Documentation/config/pack.txt
+7
@@ -27,6 +27,13 @@ Note that changing the compression level will not automatically recompress
27 all existing objects. You can force recompression by passing the -F option
28 to linkgit:git-repack[1].
29
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 +
37 pack.island::
38 An extended regular expression configuring a set of delta
39 islands. See "DELTA ISLANDS" in linkgit:git-pack-objects[1]
builtin/pack-objects.c
+7 -1
@@ -96,6 +96,7 @@ static off_t reuse_packfile_offset;
96
97 static int use_bitmap_index_default = 1;
98 static int use_bitmap_index = -1;
99 +static int allow_pack_reuse = 1;
100 static enum {
101 WRITE_BITMAP_FALSE = 0,
102 WRITE_BITMAP_QUIET,
@@ -2715,6 +2716,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
2716 use_bitmap_index_default = git_config_bool(k, v);
2717 return 0;
2718 }
2719 + if (!strcmp(k, "pack.allowpackreuse")) {
2720 + allow_pack_reuse = git_config_bool(k, v);
2721 + return 0;
2722 + }
2723 if (!strcmp(k, "pack.usesparse")) {
2724 sparse = git_config_bool(k, v);
2725 return 0;
@@ -3050,7 +3055,8 @@ static void loosen_unused_packed_objects(void)
3055 */
3056 static int pack_options_allow_reuse(void)
3057 {
3053 - return pack_to_stdout &&
3058 + return allow_pack_reuse &&
3059 + pack_to_stdout &&
3060 allow_ofs_delta &&
3061 !ignore_packed_keep_on_disk &&
3062 !ignore_packed_keep_in_core &&