[PATCHv4] transport: Catch non positive --depth option value
>From 4f3b24379090b7b69046903fba494f3191577b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Tue, 26 Nov 2013 12:38:19 +0100 Subject: [PATCH] transport: Catch non positive --depth option value Instead of simply ignoring the value passed to --depth option when it is zero or negative, now it is caught and reported. This will let people know that they were using the option incorrectly (as depth<0 should be simply invalid, and under the hood depth==0 didn't have any effect). (The change in fetch.c is needed to avoid the tests failing because of this new restriction.) Signed-off-by: Andres G. Aragoneses Reviewed-by: Duy Nguyen --- 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 bd7a101..88c04d7 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -770,7 +770,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 7202b77..5b42ccb 100644 --- a/transport.c +++ b/transport.c @@ -483,6 +483,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; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3] transport: Catch non positive --depth option value
On 26/11/13 04:06, Duy Nguyen wrote: > On Tue, Nov 26, 2013 at 6:34 AM, "Andrés G. Aragoneses" > wrote: >> On 22/11/13 02:18, Duy Nguyen wrote: >>> On Fri, Nov 22, 2013 at 3:18 AM, Junio C Hamano wrote: >>>> Have you run the tests with this patch? It seems that it breaks >>>> quite a lot of them, including t5500, t5503, t5510, among others. >>> >>> I guess it's caused by builtin/fetch.c:backfill_tags(). And the call >>> could be replaced with >>> >>> transport_set_option(transport, TRANS_OPT_DEPTH, NULL); >>> >> >> Not sure what you mean, >> https://github.com/git/git/blob/master/t/t5550-http-fetch.sh doesn't >> call backfill_tags. What do you mean? That was a typo, I meant https://github.com/git/git/blob/master/t/t5500-fetch-pack.sh > I wrote "I guess" ;-) I did not check what t5550 does. Any hint on where to start looking? It doesn't look like any test is using a non-positive depth, so I'm really confused. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3] transport: Catch non positive --depth option value
On 22/11/13 02:18, Duy Nguyen wrote: > On Fri, Nov 22, 2013 at 3:18 AM, Junio C Hamano wrote: >> Have you run the tests with this patch? It seems that it breaks >> quite a lot of them, including t5500, t5503, t5510, among others. > > I guess it's caused by builtin/fetch.c:backfill_tags(). And the call > could be replaced with > > transport_set_option(transport, TRANS_OPT_DEPTH, NULL); > Not sure what you mean, https://github.com/git/git/blob/master/t/t5550-http-fetch.sh doesn't call backfill_tags. What do you mean? Thanks -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv3] transport: Catch non positive --depth option value
>From 99e387151594572dc136bf1fae45593ee710e817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Wed, 13 Nov 2013 16:55:08 +0100 Subject: [PATCH] transport: Catch non positive --depth option value Instead of simply ignoring the value passed to --depth option when it is zero or negative, now it is caught and reported. This will let people know that they were using the option incorrectly (as depth<0 should be simply invalid, and under the hood depth==0 didn't have any effect). Signed-off-by: Andres G. Aragoneses Reviewed-by: Duy Nguyen Reviewed-by: Junio C Hamano --- transport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transport.c b/transport.c index 7202b77..edd63eb 100644 --- a/transport.c +++ b/transport.c @@ -483,6 +483,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; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCHv2] transport: Catch non positive --depth option value
Instead of simply ignoring the value passed to --depth option when it is zero or negative, now it is caught and reported. This will let people know that they were using the option incorrectly (as depth<0 should be simply invalid, and under the hood depth==0 didn't have any effect). Signed-off-by: Andres G. Aragoneses Reviewed-by: Duy Nguyen Reviewed-by: Junio C Hamano --- transport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transport.c b/transport.c index 7202b77..edd63eb 100644 --- a/transport.c +++ b/transport.c @@ -483,6 +483,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' (non positive)", value); } return 0; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] transport: Catch non positive --depth option value
Instead of simply ignoring the value passed to --depth option when it is zero or negative, now it is caught and reported. This will let people know that they were using the option incorrectly (as depth<0 should be simply invalid, and under the hood depth==0 didn't mean 'no depth' or 'no history' but 'full depth' instead). Signed-off-by: Andres G. Aragoneses --- transport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/transport.c b/transport.c index 7202b77..edd63eb 100644 --- a/transport.c +++ b/transport.c @@ -483,6 +483,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' (non positive)", value); } return 0; } -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html