# does clone --depth work?

3 messages from 2009-11-29 to 2009-11-30. Participants: Dan Carpenter, Björn Steinbrink.
Thread: https://gitlist.dev/t/21786

## Dan Carpenter, 2009-11-29 16:03

Subject: does clone --depth work?
Message-ID: <20091129160352.GO10640@bicker>
URL: https://gitlist.dev/e/20091129160352.GO10640%40bicker

```
I do: `git clone --depth 0 ./repo1/ repo2`  I expected that 
"git log" in repo2 wouldn't show any revisions, but it does.

I'm using 1.6.5.3.171.ge36e.dirty (small unrelated modification).

Am I doing something incorrectly?

regards,
dan carpenter

```

## Björn Steinbrink, 2009-11-29 16:32

Subject: Re: does clone --depth work?
Message-ID: <20091129163242.GA7921@atjola.homenet>
URL: https://gitlist.dev/e/20091129163242.GA7921%40atjola.homenet
In-Reply-To: <20091129160352.GO10640@bicker>

```
On 2009.11.29 18:03:52 +0200, Dan Carpenter wrote:
> I do: `git clone --depth 0 ./repo1/ repo2`  I expected that 
> "git log" in repo2 wouldn't show any revisions, but it does.
> 
> I'm using 1.6.5.3.171.ge36e.dirty (small unrelated modification).
> 
> Am I doing something incorrectly?

Two problems:
a) IIRC depth = 0 is like not specifying depth at all
b) When using plain paths, clone optimizes the process by just doing a
copy, that doesn't apply the depth setting at all

git clone --depth=1 file://$PWD/repo1 repo2

That should work. Of course you still got some commits, so "git log"
will show them. You just don't get all of them, but only to a certain
depth.

Björn

```

## Dan Carpenter, 2009-11-30 08:18

Subject: Re: does clone --depth work?
Message-ID: <20091130081800.GR10640@bicker>
URL: https://gitlist.dev/e/20091130081800.GR10640%40bicker
In-Reply-To: <20091129163242.GA7921@atjola.homenet>

```
On Sun, Nov 29, 2009 at 05:32:42PM +0100, Björn Steinbrink wrote:
> On 2009.11.29 18:03:52 +0200, Dan Carpenter wrote:
> > I do: `git clone --depth 0 ./repo1/ repo2`  I expected that 
> > "git log" in repo2 wouldn't show any revisions, but it does.
> > 
> > I'm using 1.6.5.3.171.ge36e.dirty (small unrelated modification).
> > 
> > Am I doing something incorrectly?
> 
> Two problems:
> a) IIRC depth = 0 is like not specifying depth at all
> b) When using plain paths, clone optimizes the process by just doing a
> copy, that doesn't apply the depth setting at all
> 
> git clone --depth=1 file://$PWD/repo1 repo2
> 

Awesome.  That does work.

thanks,
dan

> That should work. Of course you still got some commits, so "git log"
> will show them. You just don't get all of them, but only to a certain
> depth.
> 
> Björn

```
