public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Andrés G. Aragoneses" <knocte@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] transport: Catch non positive --depth option value
Date: Mon, 18 Nov 2013 08:51:16 -0800	[thread overview]
Message-ID: <xmqqzjp1bqm3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <5283A380.9030308@gmail.com> ("Andrés G. Aragoneses"'s message of "Wed, 13 Nov 2013 17:06:24 +0100")

"Andrés G. Aragoneses" <knocte@gmail•com> 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 mean 'no depth' or
> 'no history' but 'full depth' instead).

My initial knee-jerk reaction was: doesn't this change break
existing use to unplug a shallow repository and bring it to a
repository with an unshallow one to disallow depth=0, though?

I somehow thought that the code supports unshallowing with --depth=0
even though since 4dcb167f (fetch: add --unshallow for turning
shallow repo into complete one, 2013-01-11), the officially
supported way to tell Git to unshallow is with that option.

But apparently that is not the case; I do not think depth==0 meant
'full depth' (i.e. "git fetch --depth=0" did not unshallow); it was
simply ignored in fetch_pack.c::find_common() and friends.

So I think it should be a safe change to disallow non-positive depth
like this patch does, but the proposed commit log message may need
polishing.

Thanks.

> Signed-off-by: Andres G. Aragoneses <knocte@gmail•com>
> ---
>  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;
>  	}

  parent reply	other threads:[~2013-11-18 16:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-13 16:06 [PATCH] transport: Catch non positive --depth option value "Andrés G. Aragoneses"
2013-11-16  2:58 ` Duy Nguyen
2013-11-18 16:51 ` Junio C Hamano [this message]
2013-11-18 22:45   ` [PATCHv2] " "Andrés G. Aragoneses"
2013-11-19 17:15     ` Junio C Hamano
2013-11-21 15:27       ` [PATCHv3] " "Andrés G. Aragoneses"
2013-11-21 17:34         ` Junio C Hamano
2013-11-21 20:18         ` Junio C Hamano
2013-11-22  1:18           ` Duy Nguyen
2013-11-25 23:34             ` "Andrés G. Aragoneses"
2013-11-26  3:06               ` Duy Nguyen
2013-11-26 10:43                 ` "Andrés G. Aragoneses"
2013-11-26 11:09                   ` Duy Nguyen
2013-11-26 11:41                     ` [PATCHv4] " "Andrés G. Aragoneses"
2013-11-26 19:09                       ` Jonathan Nieder
2013-11-26 22:19                       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzjp1bqm3.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=knocte@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox