git 如何从 HomeBrew 中删除浅克隆警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45782694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:52:06  来源:igfitidea点击:

How to remove the shallow clone warning from HomeBrew

githomebrew

提问by lucky yang

?  ~ brew info test 
Error: No available formula with the name "test" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.

I have modified the git remote address to mirror address of homebrew before. Maybe it's relevant to this but I don't know.

之前我已经将git远程地址修改为homebrew的镜像地址。也许这与此有关,但我不知道。

回答by ryenus

Just as what it says

正如它所说的

To get complete history run:

git -C "$(brew --repo homebrew/core)" fetch --unshallow

要获得完整的历史运行:

git -C "$(brew --repo homebrew/core)" fetch --unshallow

This way brew infocould search for formula that existed only in the past but removed at some point.

这种方式brew info可以搜索过去只存在但在某个时间点删除的公式。

It might help in certain cases but probably not much. For example, the error could be caused by a typo in the formula name you're trying to lookup. In these cases I just ignore this error, rather than fetch all the history commits.

在某些情况下它可能会有所帮助,但可能不会有太大帮助。例如,错误可能是由您尝试查找的公式名称中的拼写错误引起的。在这些情况下,我只是忽略此错误,而不是获取所有历史提交。

回答by Hedge

I would advise against unshallowing the clone because it cramps disk space, makes the lookups slower and enables you only to install obsolete or unmaintaned applications.

我建议不要取消克隆,因为它会占用磁盘空间,使查找速度变慢,并且只能安装过时或未维护的应用程序。

There is currently no way to silence this warning. It was proposed in this Github issuebut then ignored.

目前没有办法消除这个警告。它是在这个Github 问题中提出的,但后来被忽略了。

The function deleted_reasonwhich prints the message contains a silentargument but afaik there is no way to use to use something like silentfrom the CLI commands which later call deleted_reason.

deleted_reason打印消息的函数包含一个silent参数,但无法使用silent来自 CLI 命令的类似命令,稍后调用deleted_reason.