# "git clone --depth <depth>" producing history with <depth + 1> commits?

6 messages from 2009-03-26 to 2009-04-02. Participants: Sebastian Pipping, Johannes Schindelin, Junio C Hamano.
Thread: https://gitlist.dev/t/18574

## Sebastian Pipping, 2009-03-26 17:00

Subject: "git clone --depth <depth>" producing history with <depth + 1> commits?
Message-ID: <49CBB490.8040908@hartwork.org>
URL: https://gitlist.dev/e/49CBB490.8040908%40hartwork.org

```
Hello!


Is "git clone --depth 1 <ropository>" expected to give a history
with 2 commits?  "--depth 2" gives 3 commits, "--depth 0" all.

Is that by design or a bug?



Sebastian

```

## Sebastian Pipping, 2009-04-01 19:39

Subject: Re: "git clone --depth <depth>" producing history with <depth + 1> commits?
Message-ID: <49D3C300.1040303@hartwork.org>
URL: https://gitlist.dev/e/49D3C300.1040303%40hartwork.org
In-Reply-To: <49CBB490.8040908@hartwork.org>

```
Sebastian Pipping wrote:
> Is "git clone --depth 1 <ropository>" expected to give a history
> with 2 commits?  "--depth 2" gives 3 commits, "--depth 0" all.
> 
> Is that by design or a bug?

Anyone?  Is "git clone --depth 1 <ropository>" really
supposed to produce a history holding _two_ commits?  Why so?



Sebastian

```

## Johannes Schindelin, 2009-04-02 01:04

Subject: Re: "git clone --depth <depth>" producing history with <depth + 1> commits?
Message-ID: <alpine.DEB.1.00.0904020303320.10279@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0904020303320.10279%40pacific.mpi-cbg.de
In-Reply-To: <49D3C300.1040303@hartwork.org>

```
Hi,

On Wed, 1 Apr 2009, Sebastian Pipping wrote:

> Sebastian Pipping wrote:
> > Is "git clone --depth 1 <ropository>" expected to give a history
> > with 2 commits?  "--depth 2" gives 3 commits, "--depth 0" all.
> > 
> > Is that by design or a bug?
> 
> Anyone?  Is "git clone --depth 1 <ropository>" really supposed to 
> produce a history holding _two_ commits?  Why so?

Because storing _no_ commit (according to you, that should happen with 
--depth=0) would make no sense?

After all, if you want to clone, you want to clone at least _something_.

Ciao,
Dscho

```

## Sebastian Pipping, 2009-04-02 01:19

Subject: Re: "git clone --depth <depth>" producing history with <depth + 1> commits?
Message-ID: <49D4128D.7000803@hartwork.org>
URL: https://gitlist.dev/e/49D4128D.7000803%40hartwork.org
In-Reply-To: <alpine.DEB.1.00.0904020303320.10279@pacific.mpi-cbg.de>

```
Johannes Schindelin wrote:
>> Anyone?  Is "git clone --depth 1 <ropository>" really supposed to 
>> produce a history holding _two_ commits?  Why so?
> 
> Because storing _no_ commit (according to you, that should happen with 
> --depth=0) would make no sense?
> 
> After all, if you want to clone, you want to clone at least _something_.

I'm aware you need one commit at least.

I didn't think of several branches before.
I guess that's resolving the core of my question.




Sebastian

```

## Junio C Hamano, 2009-04-02 02:33

Subject: Re: "git clone --depth <depth>" producing history with <depth + 1> commits?
Message-ID: <7veiwbokd7.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7veiwbokd7.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.DEB.1.00.0904020303320.10279@pacific.mpi-cbg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Wed, 1 Apr 2009, Sebastian Pipping wrote:
>
>> Sebastian Pipping wrote:
>> > Is "git clone --depth 1 <ropository>" expected to give a history
>> > with 2 commits?  "--depth 2" gives 3 commits, "--depth 0" all.
>> > 
>> > Is that by design or a bug?
>> 
>> Anyone?  Is "git clone --depth 1 <ropository>" really supposed to 
>> produce a history holding _two_ commits?  Why so?
>
> Because storing _no_ commit (according to you, that should happen with 
> --depth=0) would make no sense?

But then you can error out upon such a request.

> After all, if you want to clone, you want to clone at least _something_.

I am a bit puzzled by your logic.  If one is requested, shouldn't you give
only one and not two?

```

## Johannes Schindelin, 2009-04-02 11:00

Subject: Re: "git clone --depth <depth>" producing history with <depth + 1> commits?
Message-ID: <alpine.DEB.1.00.0904021248080.7464@intel-tinevez-2-302>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0904021248080.7464%40intel-tinevez-2-302
In-Reply-To: <7veiwbokd7.fsf@gitster.siamese.dyndns.org>

```
Hi,

On Wed, 1 Apr 2009, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Wed, 1 Apr 2009, Sebastian Pipping wrote:
> >
> >> Sebastian Pipping wrote:
> >> > Is "git clone --depth 1 <ropository>" expected to give a history 
> >> > with 2 commits?  "--depth 2" gives 3 commits, "--depth 0" all.
> >> > 
> >> > Is that by design or a bug?
> >> 
> >> Anyone?  Is "git clone --depth 1 <ropository>" really supposed to 
> >> produce a history holding _two_ commits?  Why so?
> >
> > Because storing _no_ commit (according to you, that should happen with 
> > --depth=0) would make no sense?
> 
> But then you can error out upon such a request.

Right.  Or disable the shallow cloning, as is the case now.

> > After all, if you want to clone, you want to clone at least 
> > _something_.
> 
> I am a bit puzzled by your logic.  If one is requested, shouldn't you 
> give only one and not two?

Reading the OP again, I have to apologize: I missed the fact that there is 
no way to have _just_ one commit.

And that is very obviously a bug.

If nobody beats me to it, I will take care of it this weekend.

Ciao,
Dscho

```
