pack-objects: warn on split packs disabling bitmaps
It can be tempting for a server admin to want a stable set of long-lived packs for dumb clients; but also want to enable bitmaps to serve smart clients more quickly. Unfortunately, such a configuration is impossible; so at least warn users of this incompatibility since commit 21134714 (pack-objects: turn off bitmaps when we split packs, 2014-10-16). Tested the warning by inspecting the output of: make -C t t5310-pack-bitmaps.sh GIT_TEST_OPTS=-v Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Wong committed
Apr 28, 2016 at 07:28 UTC
9cea46cdda9359e54aec379c4b4e2f9470c35023
4 files changed
+23
-9
Documentation/config.txt
+8
-4
@@ -2147,8 +2147,11 @@ pack.packSizeLimit::
2147
The maximum size of a pack. This setting only affects
2148
packing to a file when repacking, i.e. the git:// protocol
2149
is unaffected. It can be overridden by the `--max-pack-size`
2150
- option of linkgit:git-repack[1]. The minimum size allowed is
2151
- limited to 1 MiB. The default is unlimited.
2150
+ option of linkgit:git-repack[1]. Reaching this limit results
2151
+ in the creation of multiple packfiles; which in turn prevents
2152
+ bitmaps from being created.
2153
+ The minimum size allowed is limited to 1 MiB.
2154
+ The default is unlimited.
2155
Common unit suffixes of 'k', 'm', or 'g' are
2156
supported.
2157
@@ -2548,8 +2551,9 @@ repack.writeBitmaps::
2551
objects to disk (e.g., when `git repack -a` is run). This
2552
index can speed up the "counting objects" phase of subsequent
2553
packs created for clones and fetches, at the cost of some disk
2551
- space and extra time spent on the initial repack. Defaults to
2552
- false.
2554
+ space and extra time spent on the initial repack. This has
2555
+ no effect if multiple packfiles are created.
2556
+ Defaults to false.
2557
2558
rerere.autoUpdate::
2559
When set to true, `git-rerere` updates the index with the
Documentation/git-pack-objects.txt
+2
-1
@@ -110,7 +110,8 @@ base-name::
110
--max-pack-size=<n>::
111
Maximum size of each output pack file. The size can be suffixed with
112
"k", "m", or "g". The minimum size allowed is limited to 1 MiB.
113
- If specified, multiple packfiles may be created.
113
+ If specified, multiple packfiles may be created, which also
114
+ prevents the creation of a bitmap index.
115
The default is unlimited, unless the config variable
116
`pack.packSizeLimit` is set.
117
Documentation/git-repack.txt
+5
-3
@@ -106,7 +106,8 @@ other objects in that pack they already have locally.
106
--max-pack-size=<n>::
107
Maximum size of each output pack file. The size can be suffixed with
108
"k", "m", or "g". The minimum size allowed is limited to 1 MiB.
109
- If specified, multiple packfiles may be created.
109
+ If specified, multiple packfiles may be created, which also
110
+ prevents the creation of a bitmap index.
111
The default is unlimited, unless the config variable
112
`pack.packSizeLimit` is set.
113
@@ -115,7 +116,8 @@ other objects in that pack they already have locally.
116
Write a reachability bitmap index as part of the repack. This
117
only makes sense when used with `-a` or `-A`, as the bitmaps
118
must be able to refer to all reachable objects. This option
118
- overrides the setting of `pack.writeBitmaps`.
119
+ overrides the setting of `repack.writeBitmaps`. This option
120
+ has no effect if multiple packfiles are created.
121
122
--pack-kept-objects::
123
Include objects in `.keep` files when repacking. Note that we
@@ -123,7 +125,7 @@ other objects in that pack they already have locally.
125
This means that we may duplicate objects, but this makes the
126
option safe to use when there are concurrent pushes or fetches.
127
This option is generally only useful if you are writing bitmaps
126
- with `-b` or `pack.writeBitmaps`, as it ensures that the
128
+ with `-b` or `repack.writeBitmaps`, as it ensures that the
129
bitmapped packfile has the necessary objects.
130
131
Configuration
builtin/pack-objects.c
+8
-1
@@ -759,6 +759,10 @@ static off_t write_reused_pack(struct sha1file *f)
759
return reuse_packfile_offset - sizeof(struct pack_header);
760
}
761
762
+static const char no_split_warning[] = N_(
763
+"disabling bitmap writing, packs are split due to pack.packSizeLimit"
764
+);
765
+
766
static void write_pack_file(void)
767
{
768
uint32_t i = 0, j;
@@ -813,7 +817,10 @@ static void write_pack_file(void)
817
fixup_pack_header_footer(fd, sha1, pack_tmp_name,
818
nr_written, sha1, offset);
819
close(fd);
816
- write_bitmap_index = 0;
820
+ if (write_bitmap_index) {
821
+ warning(_(no_split_warning));
822
+ write_bitmap_index = 0;
823
+ }
824
}
825
826
if (!pack_to_stdout) {