summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-12 14:49:03 -0800
committerJunio C Hamano <gitster@pobox.com>2013-12-12 14:49:04 -0800
commiteb71c082c1c3937a8859a65a63e0687fe601e098 (patch)
tree9239bb6eaaa247f2b5f6d4fe8a1a5c99ba9c5cc1
parentb020a2cc27674fa5cdc9ed66d9a692e485d1cd78 (diff)
parent5594bcad21da70d2e9704cf96baa91b8d99dc27b (diff)
downloadgit-eb71c082c1c3937a8859a65a63e0687fe601e098.tar.gz
Merge branch 'nd/transport-positive-depth-only' into jch
* nd/transport-positive-depth-only: clone,fetch: catch non positive --depth option value
-rw-r--r--builtin/clone.c4
-rw-r--r--builtin/fetch.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index ec4d1cd2bb..f98f52980d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -796,6 +796,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (option_local > 0 && !is_local)
warning(_("--local is ignored"));
+ /* no need to be strict, transport_set_option() will validate it again */
+ if (option_depth && atoi(option_depth) < 1)
+ die(_("depth %s is not a positive number"), option_depth);
+
if (argc == 2)
dir = xstrdup(argv[1]);
else
diff --git a/builtin/fetch.c b/builtin/fetch.c
index e3ac84a0dd..1e7d617f46 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1079,6 +1079,10 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
}
}
+ /* no need to be strict, transport_set_option() will validate it again */
+ if (depth && atoi(depth) < 1)
+ die(_("depth %s is not a positive number"), depth);
+
if (recurse_submodules != RECURSE_SUBMODULES_OFF) {
if (recurse_submodules_default) {
int arg = parse_fetch_recurse_submodules_arg("--recurse-submodules-default", recurse_submodules_default);