From 0f284b111bc819260f1f8a94eac8e93eb29195f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Tue, 26 Nov 2013 12:41:09 +0100 Subject: transport: 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. A negative depth should be simply invalid, and under the hood depth==0 didn't have any effect. The change in fetch.c is needed because it was passing "0" explicitly, knowing that it was a no-op; under this new world order, it will be an error. Signed-off-by: Andres G. Aragoneses Reviewed-by: Duy Nguyen Signed-off-by: Junio C Hamano --- builtin/fetch.c | 2 +- transport.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/builtin/fetch.c b/builtin/fetch.c index 564705555b..743e74abd4 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -756,7 +756,7 @@ static void backfill_tags(struct transport *transport, struct ref *ref_map) } transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, NULL); - transport_set_option(transport, TRANS_OPT_DEPTH, "0"); + transport_set_option(transport, TRANS_OPT_DEPTH, NULL); fetch_refs(transport, ref_map); if (gsecondary) { diff --git a/transport.c b/transport.c index de255880a4..2250612945 100644 --- a/transport.c +++ b/transport.c @@ -481,6 +481,8 @@ static int set_git_option(struct git_transport_options *opts, opts->depth = strtol(value, &end, 0); if (*end) die("transport: invalid depth option '%s'", value); + if (opts->depth < 1) + die("transport: invalid depth option '%s' (must be positive)", value); } return 0; } -- cgit v1.2.1