Commit f94d404
authored
fix: cloning large repo's failed with
This only manifested with `--bare --mirror` because the clones are so
large, due to including all refs.
Also switched to using `httputil.ReverseProxy`, which is more robust.
```
~/dev/cachew $ rm -rf git-source ; time git clone --bare --mirror http://127.0.0.1:8080/git/github.com/git/git.git git-source
Cloning into bare repository 'git-source'...
remote: Enumerating objects: 807474, done.
remote: Counting objects: 100% (8533/8533), done.
remote: Compressing objects: 100% (7947/7947), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 297 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
git clone --bare --mirror http://127.0.0.1:8080/git/github.com/git/git.git 5.26s user 1.17s system 21% cpu 30.509 total
```
Once the cache is populated, cloning git takes half the time:
```
~/dev/cachew $ rm -rf git-source ; time git clone http://127.0.0.1:8080/git/github.com/git/git.git git-source
Cloning into 'git-source'...
remote: Enumerating objects: 403536, done.
remote: Counting objects: 100% (756/756), done.
remote: Compressing objects: 100% (363/363), done.
remote: Total 403536 (delta 532), reused 498 (delta 393), pack-reused 402780 (from 4)
Receiving objects: 100% (403536/403536), 282.29 MiB | 19.06 MiB/s, done.
Resolving deltas: 100% (305003/305003), done.
git clone http://127.0.0.1:8080/git/github.com/git/git.git git-source 18.61s user 2.65s system 96% cpu 21.940 total
~/dev/cachew $ rm -rf git-source ; time git clone http://127.0.0.1:8080/git/github.com/git/git.git git-source
Cloning into 'git-source'...
remote: Enumerating objects: 403536, done.
remote: Counting objects: 100% (403536/403536), done.
remote: Compressing objects: 100% (95986/95986), done.
remote: Total 403536 (delta 305001), reused 403485 (delta 304954), pack-reused 0 (from 0)
Receiving objects: 100% (403536/403536), 282.15 MiB | 117.21 MiB/s, done.
Resolving deltas: 100% (305001/305001), done.
git clone http://127.0.0.1:8080/git/github.com/git/git.git git-source 18.11s user 2.34s system 206% cpu 9.916 total
```fatal: early EOF (#33)1 parent 2a551be commit f94d404
3 files changed
Lines changed: 34 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
90 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
91 | 102 | | |
92 | 103 | | |
93 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
82 | 98 | | |
83 | 99 | | |
84 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | | - | |
15 | | - | |
| 12 | + | |
16 | 13 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 14 | + | |
23 | 15 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 16 | + | |
| 17 | + | |
55 | 18 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 19 | + | |
59 | 20 | | |
0 commit comments