Hi,

On Fri, 11 Apr 2025 at 17:54, Ludovic Courtès <l...@gnu.org> wrote:

> I noticed something funny (?) with libgit2 when cloning from a local repo:
> one of file:///path/to/repo and /path/to/repo is much faster than the
> other (I forgot which one).  Try it!

Well, /path/to/repo is MUCH faster.  It’s not the same planet. :-)

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (define clone* (@@ (guix git) clone*))

scheme@(guix-user)> ,time (clone* 
"/home/simon/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq"
 "/tmp/plain-path")
$1 = #<git-repository 10b78180>
;; 0.874735s real time, 0.869965s run time.  0.000000s spent in GC.

scheme@(guix-user)> ,time (clone* 
"file:///home/simon/.cache/guix/checkouts/pjmkglp4t7znuugeurpurzikxq3tnlaywmisyr27shj7apsnalwq"
 "/tmp/file-stuff")
$2 = #<git-repository 10beff00>
;; 1065.821889s real time, 2565.946633s run time.  45.590940s spent in GC.
--8<---------------cut here---------------end--------------->8---

It’s well-known; see <https://github.com/libgit2/libgit2/issues/2836>.

Please note these subtle differences:

--8<---------------cut here---------------start------------->8---
$ diff -rq plain-path file-stuff
Files plain-path/.git/config and file-stuff/.git/config differ
Files plain-path/.git/FETCH_HEAD and file-stuff/.git/FETCH_HEAD differ
Files plain-path/.git/index and file-stuff/.git/index differ
Files plain-path/.git/logs/HEAD and file-stuff/.git/logs/HEAD differ
Files plain-path/.git/logs/refs/heads/master and 
file-stuff/.git/logs/refs/heads/master differ
Files plain-path/.git/logs/refs/remotes/origin/master and 
file-stuff/.git/logs/refs/remotes/origin/master differ
Only in file-stuff/.git/objects/pack: 
pack-6fb408302ec38ea4ad5e00e43d3e2064f812e20d.idx
Only in file-stuff/.git/objects/pack: 
pack-6fb408302ec38ea4ad5e00e43d3e2064f812e20d.pack
Only in plain-path/.git/objects/pack: 
pack-b720dcc8dc301a15f339f96022598b1cb40a38cd.idx
Only in plain-path/.git/objects/pack: 
pack-b720dcc8dc301a15f339f96022598b1cb40a38cd.pack

$ du -s plain-path file-stuff
705948  plain-path
701200  file-stuff
--8<---------------cut here---------------end--------------->8---


Cheers,
simon

Reply via email to