Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只需要一行代码,减少一半的磁盘占用并提高扩展包同步效率 #353

Open
GoddessLuBoYan opened this issue May 4, 2024 · 4 comments

Comments

@GoddessLuBoYan
Copy link

GoddessLuBoYan commented May 4, 2024

Is your feature request related to a problem? Please describe.
使用git同步武将扩展包时,磁盘占用空间为扩展包本身的2倍,其中.git作为历史提交信息,游戏时用处不大,但其大小与扩展包本身不相上下。如图所示。

image

Describe the solution you'd like
程序中从git同步扩展包时,增加一个命令行参数 "--depth=1" 意为只同步某分支最新版本的代码,不考虑其历史提交信息。

Describe alternatives you've considered
如果需要恢复历史信息,可以更改.git/config文件,然后更改以下文本:

...
[remote "origin"]
    ...
    fetch = +refs/heads/*:refs/remotes/origin/*

这一行fetch就表示git fetch时会同步哪些信息,改成这种样式后再执行git fetch即可恢复到没有命令行参数"--depth"时的状态。(如此法无效,可询问文心一言等大模型,反正我成功过一次)

@Notify-ctrl
Copy link
Collaborator

libgit2不支持shallow clone

@Notify-ctrl
Copy link
Collaborator

以及就算depth=1的话,.git目录的体积也不会减少多少的,问题关键在于怎么把资源文件和拓展本身分开

@GoddessLuBoYan
Copy link
Author

以及就算depth=1的话,.git目录的体积也不会减少多少的,问题关键在于怎么把资源文件和拓展本身分开

那只能用gitee/github的发布release包的功能了,让扩展的作者发release包,新月杀本体优先尝试下载release包,若不存在则改为git clone

@Notify-ctrl
Copy link
Collaborator

以及就算depth=1的话,.git目录的体积也不会减少多少的,问题关键在于怎么把资源文件和拓展本身分开

那只能用gitee/github的发布release包的功能了,让扩展的作者发release包,新月杀本体优先尝试下载release包,若不存在则改为git clone

更新怎么办,要用等价于git pull和git checkout的功能的,每次下个release你觉得理智吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants