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

Re: [PATCH v3] builtin/clone.c: add --reject-shallow option

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 10, 2021, 16:27 UTC
Message-ID
<xmqq5z2z51nb.fsf@gitster.c.googlers.com>
In-Reply-To
<5c4295e46b7f11eb8acc0024e87935e7@oschina.cn>
"lilinchao@oschina.cn" <lilinchao@oschina.cn> writes:
> Sorry, you may forget there is a re-read git-config under these lines

Ahhhh, thanks. You're right that "clone" is "special" in that way and requires unusual order---I forgot about that.

Show 20 quoted lines
>>This is only for cloning from a local repository, no?  IOW, path at
>>this point may even be "git://github.com/git/git/" and checking with
>>access() does not make sense.
>>
>>Ah, it is even worse.  get_repo_path() can return NULL, so mkpath()
>>will crash in such a case.  This must be at least
>>
>>	if (path && !access(mkpath("%s/shallow", path), F_OK))
>>	is_shallow = 1;
>> ...
>>
>>So, I think the above two hunks are making the code worse.  If we
>>are to detect and reject cloning from the shallow repository when
>>going through the transport layer (i.e. "--no-local" or cloning from
>>"git://github.com/git/git", or "https://github.com/git/git", if it
>>were a shallow repository), that must be handled separately.
>> 
> Sorry, I made the question simple. Reject cloning a shallow repository
> should apply to all four type transport protocols. There still a bunch of
> work to be done.

Sorry, but I didn't realize that this is just a work-in-progress that shows an early "only local transport is covered" preview. I think, modulo that the access(mkpath()) thing should be in the "if (is_local)" block, the patch covers the case of local transport well enough. I think by "four types of transport" you mean ssh://, git:// https:// etc., but they all go through the same transport API, so hopefully once one of them, say, git://, is covered, that would take us a long way.

Thanks.
Previous: lilinchao@oschina.cnNext: lilinchao@oschina.cn
Message 43 of 48 in “builtin/clone.c: add --no-shallow option”
  1. builtin/clone.c: add --no-shallow optionLi Linchao via GitGitGadget, Feb 4, 2021
  2. Junio C HamanoFeb 4, 2021
  3. lilinchao@oschina.cnFeb 4, 2021
  4. Junio C HamanoFeb 4, 2021
  5. Johannes SchindelinFeb 4, 2021
  6. Junio C HamanoFeb 4, 2021
  7. 0/2 builtin/clone.c: add --no-shallow optionLi Linchao via GitGitGadget, Feb 8, 2021
  8. 1/2 builtin/clone.c: add --no-shallow optionlilinchao via GitGitGadget, Feb 8, 2021
  9. 2/2 builtin/clone.c: add --reject-shallow optionlilinchao via GitGitGadget, Feb 8, 2021
  10. Derrick StoleeFeb 8, 2021
  11. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Feb 8, 2021
  12. Junio C HamanoFeb 9, 2021
  13. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Feb 21, 2021
  14. Junio C HamanoFeb 22, 2021
  15. Jonathan TanMar 1, 2021
  16. Junio C HamanoMar 1, 2021
  17. lilinchao@oschina.cnMar 2, 2021
  18. Junio C HamanoMar 3, 2021
  19. Jonathan TanMar 4, 2021
  20. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Feb 28, 2021
  21. lilinchao@oschina.cnMar 1, 2021
  22. Johannes SchindelinMar 1, 2021
  23. lilinchao@oschina.cnMar 4, 2021
  24. Junio C HamanoMar 3, 2021
  25. lilinchao@oschina.cnMar 4, 2021
  26. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Mar 4, 2021
  27. lilinchao@oschina.cnMar 12, 2021
  28. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Mar 25, 2021
  29. Junio C HamanoMar 25, 2021
  30. Junio C HamanoMar 25, 2021
  31. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Mar 29, 2021
  32. Junio C HamanoMar 29, 2021
  33. Johannes SchindelinMar 30, 2021
  34. Junio C HamanoMar 30, 2021
  35. Johannes SchindelinMar 31, 2021
  36. builtin/clone.c: add --reject-shallow optionlilinchao via GitGitGadget, Mar 31, 2021
  37. Junio C HamanoMar 31, 2021
  38. Johannes SchindelinMar 31, 2021
  39. Junio C HamanoMar 31, 2021
  40. builtin/clone.c: add --reject-shallow optionLi Linchao via GitGitGadget, Apr 1, 2021
  41. lilinchao@oschina.cnFeb 8, 2021
  42. lilinchao@oschina.cnFeb 10, 2021
  43. Junio C HamanoFeb 10, 2021
  44. lilinchao@oschina.cnFeb 20, 2021
  45. lilinchao@oschina.cnFeb 28, 2021
  46. lilinchao@oschina.cnMar 26, 2021
  47. lilinchao@oschina.cnMar 26, 2021
  48. lilinchao@oschina.cnMar 31, 2021

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.