builtin-pack-object: cache small deltas
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <junkio@cox.net>
Martin Koegler committed
May 28, 2007 at 23:20 UTC
e3dfddb377478dbee9c5b88636e97d62312f562d
2 files changed
+12
Documentation/config.txt
+4
@@ -572,6 +572,10 @@ pack.deltaCacheSize::
572
gitlink:git-pack-objects[1].
573
A value of 0 means no limit. Defaults to 0.
574
575
+pack.deltaCacheLimit::
576
+ The maxium size of a delta, that is cached in
577
+ gitlink:git-pack-objects[1]. Defaults to 1000.
578
+
579
pull.octopus::
580
The default merge strategy to use when pulling multiple branches
581
at once.
builtin-pack-objects.c
+8
@@ -79,6 +79,7 @@ static int pack_compression_seen;
79
80
static unsigned long delta_cache_size = 0;
81
static unsigned long max_delta_cache_size = 0;
82
+static unsigned long cache_max_small_delta_size = 1000;
83
84
/*
85
* The object names in objects array are hashed with this hashtable,
@@ -1403,6 +1404,9 @@ static int delta_cacheable(struct unpacked *trg, struct unpacked *src,
1404
if (max_delta_cache_size && delta_cache_size + delta_size > max_delta_cache_size)
1405
return 0;
1406
1407
+ if (delta_size < cache_max_small_delta_size)
1408
+ return 1;
1409
+
1410
/* cache delta, if objects are large enough compared to delta size */
1411
if ((src_size >> 20) + (trg_size >> 21) > (delta_size >> 10))
1412
return 1;
@@ -1654,6 +1658,10 @@ static int git_pack_config(const char *k, const char *v)
1658
max_delta_cache_size = git_config_int(k, v);
1659
return 0;
1660
}
1661
+ if (!strcmp(k, "pack.deltacachelimit")) {
1662
+ cache_max_small_delta_size = git_config_int(k, v);
1663
+ return 0;
1664
+ }
1665
return git_default_config(k, v);
1666
}
1667