Re: About *git clone --depth=n* puzzle
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Aug 15, 2013, 02:08 UTC
- Message-ID
- <CACsJy8DDf64M1qruUNH7M=eB=1cJpYuYXLEkpPUPfrREeSLEew@mail.gmail.com>
- In-Reply-To
- <BAY169-W472B90AB796C71E8D0D038B4450@phx.gbl>
On Wed, Aug 14, 2013 at 3:20 PM, XinLingchao <douglarek@outlook.com> wrote:
Show 43 quoted lines
> Hi Guys, > > I think I have got some trouble when I use `git clone --depth=n` command. Take a real repo for example: > > > `git clone https://github.com/douglarek/vimrc.git --depth=1` > > > then I use `git log`: > > ``` > commit d04ca09ecc723739123fae11ad56784eb0c9b36a > Author: Lingchao Xin <douglarek@outlook.com> > Date: Fri Jun 7 09:39:22 2013 +0800 > > Update vnudle to master branch, add wm shortcut, pylint optimization > > commit c66d827dc212f6ae8aab6b5c44631564bcbe2acd > Author: icocoa <lingchax@outlook.com> > Date: Tue Mar 12 01:36:34 2013 -0700 > > Merge pull request #1 from douglarek/master > > Add markdown, flake8, pylint plugin > > ``` > but when I clone it with `file://`: > > git clone https://github.com/douglarek/vimrc.git > git clone file://vimrc.git --depth=1 vimrc1 > > I got this log: > ``` > commit d04ca09ecc723739123fae11ad56784eb0c9b36a > Author: Lingchao Xin <douglarek@outlook.com> > Date: Fri Jun 7 09:39:22 2013 +0800 > > Update vnudle to master branch, add wm shortcut, pylint optimization > ``` > > so the two results are not same, is it a bug? or it should be so? > > My os is openSUSE 12.3 and git version 1.8.3.4; and myabe it occured in git 1.8.1.4 +.
The fix is at the server side. >=1.8.2 corrects --depth, which is what you use for file://. github is still on 1.8.1.6, which does not have that fix. Oh and the commit is 682c7d2 (upload-pack: fix off-by-one depth calculation in shallow clone - 2013-01-11)
-- Duy