From: Junio C Hamano Date: Tue, 28 May 2013 17:04:46 GMT Subject: Re: [PATCH] git clone depth of 0 not possible. Message-ID: <7va9nf2fyp.fsf@alter.siamese.dyndns.org> In-Reply-To: <20130528091812.GG25742@login.drsnuggles.stderr.nl> Matthijs Kooijman 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: - 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 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). - 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. In the longer term, I think we should introduce a better deepening mechanism. Cf. http://thread.gmane.org/gmane.comp.version-control.git/212912/focus=212940 > Of course, one could using depth == 1 in this case to receive two > commits and then drop one, but this would seem a bit pointless to me > (especially if the commit below the tip is very different from the tip > leading to a lot of useless data transfer).