On Fri, 13 Apr 2012 09:37:47 -0700, Platonides <Platonides(a)gmail.com>
wrote:
On 13/04/12 10:29, Daniel Friesen wrote:
By the way, using --depth only saves you disk
space
(which is a trivially small amount,
I disagree, 18M vs 341M is quite noticeable.
which linked repositories can cut back on as
well).
Only if you're cloning on the same filesystem. We're talking about
a
network operation here.
When you use --depth git still needs to go
through the whole
history. So whether you are using everything or try to limit by --depth
it still takes the same amount of time to do an initial clone.
You're not counting the bandwidth needs. Transfering the whole amount is
probably the slowest operation, not the CPU time needed to traverse the
tree.
I was a little wrong about time, it does save a little bit of time:
Daniels-MacBook-Air:test daniel$ time git clone
https://dantman@github.com/dantman/mediawiki-core.git a
Cloning into 'a'...
remote: Counting objects: 398899, done.
remote: Compressing objects: 100% (52956/52956), done.
remote: Total 398899 (delta 345088), reused 398821 (delta 345010)
Receiving objects: 100% (398899/398899), 109.91 MiB | 558 KiB/s, done.
Resolving deltas: 100% (345088/345088), done.
real 4m49.148s
user 1m51.726s
sys 0m7.310s
Daniels-MacBook-Air:test daniel$ time git clone --depth=5
https://dantman@github.com/dantman/mediawiki-core.git b
Cloning into 'b'...
remote: Counting objects: 32122, done.
remote: Compressing objects: 100% (18059/18059), done.
remote: Total 32122 (delta 26125), reused 18294 (delta 13859)
Receiving objects: 100% (32122/32122), 48.25 MiB | 648 KiB/s, done.
Resolving deltas: 100% (26125/26125), done.
real 2m35.719s
user 0m13.701s
sys 0m2.041s
However I don't get where you are getting those numbers on space, they
look mistaken or biased.
This is the disk usage of a plain clone and a --depth=5 clone:
Daniels-MacBook-Air:test daniel$ du -hs *
189M a
117M b
By linked repositories I'm talking about the situation where you have
multiple copies of the repo sitting around. 200MB is nothing when you have
only one repo, it's not even worth typing --depth and the potential
downsides you could end up with. But in the case of multiple copies of the
same repo you can save a HUGE amount of space by making a --bare clone of
the remote with the whole history. And then cloning your other repos from
that one. You kill the extra network ops of course. But by using a
filesystem path you also trigger --local which makes git hardlink objects.
If you think you can use it safely there is also --shared which will
completely skip hardlinking or copying of objects and use them all
directly from the parent repo.
--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [
http://daniel.friesen.name]