Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

git - How to remove the shallow clone warning from HomeBrew

?  ~ 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As of Oct 2020 Homebrew no longer creates shallow clones when being installed, and as of Dec 2020 updating existing shallow clones is not allowed either.

(This makes the original question about silencing the warning moot).


If a shallow clone is configured, a message containing text like the below will be shown:

Error:
  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

It is now required to perform the unshallow process by running the git command(s) in the error message.

Note: This process may take a long time to complete without providing feedback.


For some details about the motivation for this change, see this discussion on Homebrew's GitHub page, specifically:

There are two major downsides of shallow cloning:

  1. It places a massive computation burden on GitHub's servers, which have to?dynamically?compute a fresh delta between what you have and the latest commit, on every?brew update. (With full clones, GitHub can simply send you all the commits that happened after your last pull, and your local Git client takes care of the rest.)
  2. Because of [1], it makes it far more likely that GitHub will rate-limit Homebrew operations, which will make it suck for everyone.

--gromgit Dec 5, 2020, 12:29 AM EST

And also this additional text added to the error message:

This restriction has been made on GitHub's request because updating shallow clones is an extremely expensive operation due to the tree layout and traffic of Homebrew/homebrew-core and Homebrew/homebrew-cask.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...