Subject: Re: [PATCHv2] transport: Catch non positive --depth option value

From: Junio C Hamano <[email-masked]>
Date: Tue, 19 Nov 2013 09:15:39 -0800

"Andrés G. Aragoneses" <[email-masked]> writes:

> 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 <[email-masked]>
> Reviewed-by: Duy Nguyen <[email-masked]>
> Reviewed-by: Junio C Hamano <[email-masked]>
> ---
>  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);

"transport: depth option '%s' must be positive", perhaps?

>          }
>          return 0;
>      }

Linewrapped and whitespace damaged.