diff options
author | Andrés G. Aragoneses <knocte@gmail.com> | 2013-11-26 12:41:09 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-11-26 14:25:00 -0800 |
commit | 0f284b111bc819260f1f8a94eac8e93eb29195f0 (patch) | |
tree | 4e480b99843d38e67e059368636771c96977335f | |
parent | becb4336cb05c5ec456babaeafefa2e24ee85773 (diff) | |
download | git-aa/transport-non-positive-depth-only.tar.gz |
transport: catch non positive --depth option valueaa/transport-non-positive-depth-only
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 <knocte@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | builtin/fetch.c | 2 | ||||
-rw-r--r-- | transport.c | 2 |
2 files changed, 3 insertions, 1 deletions
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; } |