Skip to content

Commit 9cea46c

Browse files
Eric Wonggitster
authored andcommitted
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 2113471 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 625efa9 commit 9cea46c

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

Documentation/config.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,8 +2147,11 @@ pack.packSizeLimit::
21472147
The maximum size of a pack. This setting only affects
21482148
packing to a file when repacking, i.e. the git:// protocol
21492149
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.
21522155
Common unit suffixes of 'k', 'm', or 'g' are
21532156
supported.
21542157

@@ -2548,8 +2551,9 @@ repack.writeBitmaps::
25482551
objects to disk (e.g., when `git repack -a` is run). This
25492552
index can speed up the "counting objects" phase of subsequent
25502553
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.
25532557

25542558
rerere.autoUpdate::
25552559
When set to true, `git-rerere` updates the index with the

Documentation/git-pack-objects.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ base-name::
110110
--max-pack-size=<n>::
111111
Maximum size of each output pack file. The size can be suffixed with
112112
"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.
114115
The default is unlimited, unless the config variable
115116
`pack.packSizeLimit` is set.
116117

Documentation/git-repack.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ other objects in that pack they already have locally.
106106
--max-pack-size=<n>::
107107
Maximum size of each output pack file. The size can be suffixed with
108108
"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.
110111
The default is unlimited, unless the config variable
111112
`pack.packSizeLimit` is set.
112113

@@ -115,15 +116,16 @@ other objects in that pack they already have locally.
115116
Write a reachability bitmap index as part of the repack. This
116117
only makes sense when used with `-a` or `-A`, as the bitmaps
117118
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.
119121

120122
--pack-kept-objects::
121123
Include objects in `.keep` files when repacking. Note that we
122124
still do not delete `.keep` packs after `pack-objects` finishes.
123125
This means that we may duplicate objects, but this makes the
124126
option safe to use when there are concurrent pushes or fetches.
125127
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
127129
bitmapped packfile has the necessary objects.
128130

129131
Configuration

builtin/pack-objects.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ static off_t write_reused_pack(struct sha1file *f)
759759
return reuse_packfile_offset - sizeof(struct pack_header);
760760
}
761761

762+
static const char no_split_warning[] = N_(
763+
"disabling bitmap writing, packs are split due to pack.packSizeLimit"
764+
);
765+
762766
static void write_pack_file(void)
763767
{
764768
uint32_t i = 0, j;
@@ -813,7 +817,10 @@ static void write_pack_file(void)
813817
fixup_pack_header_footer(fd, sha1, pack_tmp_name,
814818
nr_written, sha1, offset);
815819
close(fd);
816-
write_bitmap_index = 0;
820+
if (write_bitmap_index) {
821+
warning(_(no_split_warning));
822+
write_bitmap_index = 0;
823+
}
817824
}
818825

819826
if (!pack_to_stdout) {

0 commit comments

Comments
 (0)