summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 03:31:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-06 20:57:10 (GMT)
commit5594bcad21da70d2e9704cf96baa91b8d99dc27b (patch)
tree90367668eb9e3dcbe759e1bf92f3f9b385b015b0 /builtin/fetch.c
parent2f93541d88fadd1ff5307d81c2c8921ee3eea058 (diff)
downloadgit-5594bcad21da70d2e9704cf96baa91b8d99dc27b.zip
git-5594bcad21da70d2e9704cf96baa91b8d99dc27b.tar.gz
git-5594bcad21da70d2e9704cf96baa91b8d99dc27b.tar.bz2
clone,fetch: catch non positive --depth option value
Instead of simply ignoring the value passed to --depth option when it is zero or negative, catch and report it as an error to let people know that they were using the option incorrectly. Original-patch-by: Andrés G. Aragoneses <knocte@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 5647055..72930fc 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1045,6 +1045,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);