pack-objects: use bitfield for object_entry::depth
Because of struct packing from now on we can only handle max depth 4095 (or even lower when new booleans are added in this struct). This should be ok since long delta chain will cause significant slow down anyway. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0c6804ab4e
commit
b5c0cbd808
@ -2422,6 +2422,7 @@ pack.window::
|
|||||||
pack.depth::
|
pack.depth::
|
||||||
The maximum delta depth used by linkgit:git-pack-objects[1] when no
|
The maximum delta depth used by linkgit:git-pack-objects[1] when no
|
||||||
maximum depth is given on the command line. Defaults to 50.
|
maximum depth is given on the command line. Defaults to 50.
|
||||||
|
Maximum value is 4095.
|
||||||
|
|
||||||
pack.windowMemory::
|
pack.windowMemory::
|
||||||
The maximum size of memory that is consumed by each thread
|
The maximum size of memory that is consumed by each thread
|
||||||
|
@ -96,7 +96,9 @@ base-name::
|
|||||||
it too deep affects the performance on the unpacker
|
it too deep affects the performance on the unpacker
|
||||||
side, because delta data needs to be applied that many
|
side, because delta data needs to be applied that many
|
||||||
times to get to the necessary object.
|
times to get to the necessary object.
|
||||||
The default value for --window is 10 and --depth is 50.
|
+
|
||||||
|
The default value for --window is 10 and --depth is 50. The maximum
|
||||||
|
depth is 4095.
|
||||||
|
|
||||||
--window-memory=<n>::
|
--window-memory=<n>::
|
||||||
This option provides an additional limit on top of `--window`;
|
This option provides an additional limit on top of `--window`;
|
||||||
|
@ -90,7 +90,9 @@ other objects in that pack they already have locally.
|
|||||||
space. `--depth` limits the maximum delta depth; making it too deep
|
space. `--depth` limits the maximum delta depth; making it too deep
|
||||||
affects the performance on the unpacker side, because delta data needs
|
affects the performance on the unpacker side, because delta data needs
|
||||||
to be applied that many times to get to the necessary object.
|
to be applied that many times to get to the necessary object.
|
||||||
The default value for --window is 10 and --depth is 50.
|
+
|
||||||
|
The default value for --window is 10 and --depth is 50. The maximum
|
||||||
|
depth is 4095.
|
||||||
|
|
||||||
--threads=<n>::
|
--threads=<n>::
|
||||||
This option is passed through to `git pack-objects`.
|
This option is passed through to `git pack-objects`.
|
||||||
|
@ -3068,6 +3068,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
|||||||
if (pack_to_stdout != !base_name || argc)
|
if (pack_to_stdout != !base_name || argc)
|
||||||
usage_with_options(pack_usage, pack_objects_options);
|
usage_with_options(pack_usage, pack_objects_options);
|
||||||
|
|
||||||
|
if (depth >= (1 << OE_DEPTH_BITS)) {
|
||||||
|
warning(_("delta chain depth %d is too deep, forcing %d"),
|
||||||
|
depth, (1 << OE_DEPTH_BITS) - 1);
|
||||||
|
depth = (1 << OE_DEPTH_BITS) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
argv_array_push(&rp, "pack-objects");
|
argv_array_push(&rp, "pack-objects");
|
||||||
if (thin) {
|
if (thin) {
|
||||||
use_internal_rev_list = 1;
|
use_internal_rev_list = 1;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define PACK_OBJECTS_H
|
#define PACK_OBJECTS_H
|
||||||
|
|
||||||
#define OE_DFS_STATE_BITS 2
|
#define OE_DFS_STATE_BITS 2
|
||||||
|
#define OE_DEPTH_BITS 12
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* State flags for depth-first search used for analyzing delta cycles.
|
* State flags for depth-first search used for analyzing delta cycles.
|
||||||
@ -89,9 +90,7 @@ struct object_entry {
|
|||||||
unsigned tagged:1; /* near the very tip of refs */
|
unsigned tagged:1; /* near the very tip of refs */
|
||||||
unsigned filled:1; /* assigned write-order */
|
unsigned filled:1; /* assigned write-order */
|
||||||
unsigned dfs_state:OE_DFS_STATE_BITS;
|
unsigned dfs_state:OE_DFS_STATE_BITS;
|
||||||
|
unsigned depth:OE_DEPTH_BITS;
|
||||||
int depth;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct packing_data {
|
struct packing_data {
|
||||||
|
Reference in New Issue
Block a user