Re: git clone combined with --depth, --branch and --single-branch
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 17, 2013, 14:32 UTC
- Message-ID
- <CACsJy8C5G7yy=KDtdsE-9aYTdSEO3v=-25WKtGnLALshXnE+uQ@mail.gmail.com>
- In-Reply-To
- <CAByu6UWNZLrtwo+FUeq2OELoX3jo1Qng9amko36JGa5pq+y11A@mail.gmail.com>
On Sun, Feb 17, 2013 at 7:29 PM, Thibault Kruse <tibokruse@googlemail.com> wrote:
Show 17 quoted lines
> git log --pretty=format:'%h-%s %d' --graph --decorate --all > * 4565162-5 (foo) > * 20ce846-4 > * a0615eb-3 > * fa4131d-2 > * f0683bd-1 (bar) > | * 432b5ec-m1 (HEAD, master) > |/ > * 39df203-0 > > git clone repo1 repo2 --depth 1 > cd repo2 > git log --pretty=format:'%h-%s %d' --graph --decorate --all > * 432b5ec-m1 (HEAD, origin/master, origin/HEAD, master) > * 39df203-0 > > # Why are branches "foo" and "bar" missing?
--depth implies --single-branch. Without explicit --branch, --single-branch will fetch HEAD. You need --no-single-branch to get foo and bar.
Show 14 quoted lines
> cd .. > git clone repo1 repo3 --depth 1 --branch foo > git log --pretty=format:'%h-%s %d' --graph --decorate --all > * 4565162-5 (HEAD, origin/foo, foo) > * 20ce846-4 > * a0615eb-3 > * fa4131d-2 > * f0683bd-1 > | * 432b5ec-m1 (origin/master, origin/HEAD) > |/ > * 39df203-0 > > # Why is --depth not having effect, and why is branch bar not there, > yet master is?
I'm not sure, but I can't reproduce it. There's an unreleased fix in depth calculation (682c7d2 (upload-pack: fix off-by-one depth calculation in shallow clone - 2013-01-11) that might affect this. You may want to try again with "master". I got this with the same command
* edbd6cb (grafted, HEAD, origin/foo, foo) 5
-- Duy