Skip to contentSkip to conversation

does clone --depth work?

DISCUSSION Dan Carpenter 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines · Dan Carpenter

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

#2 lore raw
Quoted 6 lines · Björn Steinbrink
Quoted 5 lines · Dan Carpenter

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).

Quoted 9 lines
Quoted 1 line

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

Quoted 5 lines

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