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

Re: [PATCH] git clone depth of 0 not possible.

From
Matthijs Kooijman <matthijs@stdin.nl>
Date
May 30, 2013, 08:23 UTC
Message-ID
<20130530082322.GW25742@login.drsnuggles.stderr.nl>
In-Reply-To
<7va9nf2fyp.fsf@alter.siamese.dyndns.org>
Hi Junio,
On Tue, May 28, 2013 at 10:04:46AM -0700, Junio C Hamano wrote:
Show 15 quoted lines
> Matthijs Kooijman <matthijs@stdin.nl> writes:
> 
> > Did you consider how to implement this? Looking at the code, it seems
> > the "deepen" parameter in the wire protocol now means:
> >  - 0: Do not change anything about the shallowness (i.e., fetch
> >    everything from the shallow root to the tip).
> >  - > 0: Create new shallow commits at depth commits below the tip (so
> >    depth == 1 means tip and one below).
> >  - INFINITE_DEPTH (0x7fffffff): Remove all shallowness and fetch
> >    complete history.
> >
> > Given this, I'm not sure how one can express "fetch the tip and nothing
> > below that", since depth == 0 already has a different meaning.
> 
> Doing it "correctly" (in the shorter term) would involve:

Given below suggestion, I take it you don't like what Jonathan proposed (changing the meaning of the deepen parameter in the protocol so that the server effectively decides how to interpret --depth)?

Show 8 quoted lines
>  - adding a capability on the sending side "fixed-off-by-one-depth"
>    to the protocol, and teaching the sending side to advertise the
>    capability;
>    
>  - teaching the sending side to see if the new behaviour to fix
>    off-by-one is asked by the requestor, and stop at the correct
>    number of commits, not oversending one more.  Otherwise retain
>    the old behaviour.

We can implement these two in current git already, since they only add to the protocol, not break it in an incompatible manner, right?

Show 8 quoted lines
>  - teaching the requestor that got --depth=N from the end user to
>    pay attention to the new capability in such a way that:
> 
>    - when talking to an old sender (i.e. without the off-by-one
>      fix), send N-1 for N greater than 1.  Punt on N==1;
> 
>    - when talking to a fixed sender, ask to enable the capability,
>      and send N as is (including N==1).

And these should wait for git2, since they change the meaning of the --depth parameter? Or is this change ok for current git as well?

What do you mean by "punt" exactly? Show an error to the user, saying only depth >= 2 is supported?

> In the longer term, I think we should introduce a better deepening
> mechanism.  Cf.

Even when there will be a better deepening mechanism, the above is still useful (passing --depth=1 serves to get just a single commit without history, which is a distinct usecase from deepening the history of an existing shallow repository). In other words, I think the "improved deepening" and "fixed depth" should be complementary features.

Gr.
Matthijs
Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 29 in “git clone depth of 0 not possible.”
  1. git clone depth of 0 not possible.Stefan Beller, Jan 7, 2013
  2. Documentation on depth option in git clone.Stefan Beller, Jan 7, 2013
  3. Jonathan NiederJan 8, 2013
  4. Junio C HamanoJan 8, 2013
  5. Junio C HamanoJan 8, 2013
  6. Junio C HamanoJan 8, 2013
  7. Duy NguyenJan 8, 2013
  8. Stefan BellerJan 8, 2013
  9. Duy NguyenJan 8, 2013
  10. Junio C HamanoJan 8, 2013
  11. Duy NguyenJan 8, 2013
  12. Junio C HamanoJan 8, 2013
  13. Matthijs KooijmanMay 28, 2013
  14. Jonathan NiederMay 28, 2013
  15. Jonathan NiederMay 28, 2013
  16. Matthijs KooijmanMay 28, 2013
  17. Jonathan NiederMay 28, 2013
  18. Junio C HamanoMay 28, 2013
  19. Matthijs KooijmanMay 30, 2013
  20. Junio C HamanoJun 2, 2013
  21. Matthijs KooijmanJul 9, 2013
  22. Matthijs KooijmanJul 11, 2013
  23. 1/3 upload-pack: Remove a piece of dead codeMatthijs Kooijman, Jul 11, 2013
  24. 2/3 upload-pack: Introduce new "fixed-off-by-one-depth" server featureMatthijs Kooijman, Jul 11, 2013
  25. 3/3 fetch-pack: Request fixed-off-by-one-depth when availableMatthijs Kooijman, Jul 11, 2013
  26. Duy NguyenJul 11, 2013
  27. Junio C HamanoJul 11, 2013
  28. Duy NguyenJan 8, 2013
  29. Junio C HamanoJan 8, 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.