summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-02-05 13:58:51 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-02-05 13:58:52 -0800
commitbf03d6e92d63caa81e5ba410f0eed89b700e042d (patch)
treef8f89558fa79f9cb0e75b2f52e8cc056aff3a2e4 /builtin/clone.c
parentgit-svn: workaround for a bug in svn serf backend (diff)
parentclone,fetch: catch non positive --depth option value (diff)
downloadtgif-bf03d6e92d63caa81e5ba410f0eed89b700e042d.tar.xz
Merge branch 'nd/transport-positive-depth-only' into maint
"git fetch --depth=0" was a no-op, and was silently ignored. Diagnose it as an error. * nd/transport-positive-depth-only: clone,fetch: catch non positive --depth option value
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 874e0fd0b6..cc11104d42 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