diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-02-05 13:58:51 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-05 13:58:52 -0800 |
commit | bf03d6e92d63caa81e5ba410f0eed89b700e042d (patch) | |
tree | f8f89558fa79f9cb0e75b2f52e8cc056aff3a2e4 /builtin/fetch.c | |
parent | ac930287ff16823531b541a8e6a7436279e612be (diff) | |
parent | 5594bcad21da70d2e9704cf96baa91b8d99dc27b (diff) |
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/fetch.c')
-rw-r--r-- | builtin/fetch.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index bd7a10164f..5bd00d064a 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1075,6 +1075,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); |