git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] add warning for depth=0 in git clone.

From
Duy Nguyen <pclouds@gmail.com>
Date
Jan 9, 2013, 00:57 UTC
Message-ID
<CACsJy8BLLTWd+cTBj1jNW=ODPy7=Kg4-TPUdZ82YCE-0RQpMZA@mail.gmail.com>
In-Reply-To
<1357632422-5686-1-git-send-email-stefanbeller@googlemail.com>

On Tue, Jan 8, 2013 at 3:07 PM, Stefan Beller <stefanbeller@googlemail.com> wrote:

Show 15 quoted lines
> ---
>  builtin/clone.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/builtin/clone.c b/builtin/clone.c
> index ec2f75b..5e91c1e 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -818,6 +818,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
>         remote = remote_get(option_origin);
>         transport = transport_get(remote, remote->url[0]);
>
> +       if (option_depth && transport->smart_options->depth < 1)
> +               die(_("--depth less or equal 0 makes no sense; read manpage."));
> +
Isn't this too early for the check? The following code is
>         if (!is_local) {
>                 if (!transport->get_refs_list || !transport->fetch)
>                         die(_("Don't know how to clone %s"), transport->url);
		transport_set_option(transport, TRANS_OPT_KEEP, "yes");
		if (option_depth)
			transport_set_option(transport, TRANS_OPT_DEPTH,
					     option_depth);

where transport_set_option() calls set_git_option() to initialize transport->smart_options->depth. A check should be done after this point.

-- 
Duy
Previous: Jonathan NiederNext: Junio C Hamano
Message 5 of 18 in “add warning for depth=0 in git clone.”
  1. add warning for depth=0 in git clone.Stefan Beller, Jan 8, 2013
  2. Stefan BellerJan 8, 2013
  3. Jonathan NiederJan 8, 2013
  4. Jonathan NiederJan 8, 2013
  5. Duy NguyenJan 9, 2013
  6. On --depth=funny valueJunio C Hamano, Jan 9, 2013
  7. Duy NguyenJan 9, 2013
  8. Junio C HamanoJan 9, 2013
  9. Duy NguyenJan 9, 2013
  10. Duy NguyenJan 9, 2013
  11. Stefan BellerJan 9, 2013
  12. 1/2 fetch, upload-pack: add --no-shallow for infinite depthNguyễn Thái Ngọc Duy, Jan 11, 2013
  13. 2/2 upload-pack: fix off-by-one depth calculation in shallow cloneNguyễn Thái Ngọc Duy, Jan 11, 2013
  14. Junio C HamanoJan 11, 2013
  15. Junio C HamanoJan 11, 2013
  16. 1/3 fetch: add --unshallow for turning shallow repo into complete oneNguyễn Thái Ngọc Duy, Jan 11, 2013
  17. 2/3 upload-pack: fix off-by-one depth calculation in shallow cloneNguyễn Thái Ngọc Duy, Jan 11, 2013
  18. 3/3 fetch: elaborate --depth actionNguyễn Thái Ngọc Duy, Jan 11, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.