因为 Github/微软要求,为了避免昂贵的 shallow diff,所有用户都需要 unshallow 整个 repo 。brew update 的时候会报错直到 unshallow 。
看了下/usr/local/Homebrew/Library/Taps/
占用空间已接近 1G,并且还会继续增长。为了节省计算资源,需要所有用户献出更多硬盘资源。Linux 上包管理器是怎么解决这个问题的?
附上 unshallow 的 commands
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow
相关讨论: https://github.com/Homebrew/discussions/discussions/225
1 clrss 2020-12-11 11:01:44 +08:00 linux 包管理器一般不保存包的元数据的历史.. 我的 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core 才 220MB (已 unshallow). cask 我没有 tap, 不明. 试了下 `git gc --prune=all --aggressive` |
2 clrss 2020-12-11 11:02:41 +08:00 花了 N 久, 变 190MB 了... |
3 Kobayashi 2020-12-11 11:18:41 +08:00 via Android Linux 下没有这种问题。Homebrew 操蛋地滥用 Github 。 |
![]() | 4 huijiewei 2020-12-11 11:25:07 +08:00 运行后提醒 fatal: 对于一个完整的仓库,参数 --unshallow 没有意义 |
5 lovestudykid OP @huijiewei 你已经 run 过了? |
6 lovestudykid OP @Kobayashi Linuxbrew on the way... |
7 lovestudykid OP @clrss 多谢,有点担心会 break homebrew 。run 了一遍降到了 421M 。可能这就是 community 用 git 维护的代价,历史信息对普通用户来说根本没用,一点也不优雅... |
![]() | 8 huijiewei 2020-12-11 11:39:43 +08:00 via iPhone @lovestudykid 没有 看到这个帖子才 run 的 |
9 lovestudykid OP @huijiewei 你运行 brew update 会报错吗?我是看到报错提示才 unshallow 的 |
![]() | 10 huijiewei 2020-12-11 11:44:25 +08:00 via iPhone @lovestudykid 不会报错 我等下再试试 是不是因为用了镜像的原因 |
11 lovestudykid OP @huijiewei 大概是镜像还没更新到相应版本 |
12 Cbdy 2020-12-11 14:40:15 +08:00 via Android 其实 HomeBrew 这种用法,算是是对 GitHub 的滥用了吧,历史记录对用户根本没有意义啊 |
13 clrss 2020-12-11 16:05:06 +08:00 感觉更多的是 git 的 shallow 机制有待优化吧, 对于不带 merge 的线性历史, 后续的 fetch 应该不贵啊 |
![]() | 14 cairnechen 2020-12-15 09:16:13 +08:00 想问下这个 unshallow 操作会有什么风险吗? |
![]() | 15 mycang 2021-02-07 12:19:30 +08:00 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow remote: Counting objects: 356812, done. remote: Compressing objects: 100% (106828/106828), done. error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 fatal: the remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed 怎么办?不能 update |
16 lovestudykid OP @mycang 感觉是网络问题 |