Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-05-11 09:27:23 +0300
committerJunio C Hamano <gitster@pobox.com>2021-05-11 09:27:23 +0300
commit1af57f5d321aeb95dbdbe48bdb2b0e1e37528323 (patch)
treefecc8dcdda06c52d926b1a83bdef50ef3d36300c /builtin/pack-objects.c
parent270f8bfe0038fe84f8a08bdc26f8b4094df10b08 (diff)
parent6d52b6a5dfe0bee20dbfb2a3a7291bcf9a152672 (diff)
Merge branch 'jk/pack-objects-negative-options-fix'
Options to "git pack-objects" that take numeric values like --window and --depth should not accept negative values; the input validation has been tightened. * jk/pack-objects-negative-options-fix: pack-objects: clamp negative depth to 0 t5316: check behavior of pack-objects --depth=0 pack-objects: clamp negative window size to 0 t5300: check that we produced expected number of deltas t5300: modernize basic tests
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index cdc38c275b..6ded130e45 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3867,6 +3867,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (pack_to_stdout != !base_name || argc)
usage_with_options(pack_usage, pack_objects_options);
+ if (depth < 0)
+ depth = 0;
if (depth >= (1 << OE_DEPTH_BITS)) {
warning(_("delta chain depth %d is too deep, forcing %d"),
depth, (1 << OE_DEPTH_BITS) - 1);
@@ -3877,6 +3879,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
(1U << OE_Z_DELTA_BITS) - 1);
cache_max_small_delta_size = (1U << OE_Z_DELTA_BITS) - 1;
}
+ if (window < 0)
+ window = 0;
strvec_push(&rp, "pack-objects");
if (thin) {