0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

brew updateしたらhomebrew-core is a shallow clone.が発生する問題

Posted at

動作環境

  • macOS Catalina バージョン 10.15.7

エラー文

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
These commands may take a few minutes to run due to the large size of the repositories.
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. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!

詳細に関して確認していきます。

homebrew-core

  • Homebrewのpackage manager

Homebrew/homebrew-core

shallow clone

  • Gitの機能。
  • git cloneは元のリポジトリを全て取得する。
  • shallow cloneを使うことによって最新版だけ取得することができる。

git shallowの詳細は下記から確認できます。

--depth <depth>
Create a shallow clone with a history truncated to the specified number of commits. Implies --single-branch unless --no-single-branch is given to fetch the histories near the tips of all branches. If you want to clone submodules shallowly, also pass --shallow-submodules.

--shallow-since=<date>
Create a shallow clone with a history after the specified time.

--shallow-exclude=<revision>
Create a shallow clone with a history, excluding commits reachable from a specified remote branch or tag. This option can be specified multiple times.

Git - git-clone Documentation

git fetch --unshallow

  • リポジトリにフェッチされていない全履歴を確認することができる。
  • shallow cloneしたリポジトリであっても、git fetch --unshallowを実行することで過去の履歴も取得することができる。

解決方法

homebrew-coreはshallow cloneなので、git fetch —unshallow することによって全ての情報を取得しましょう。

下記2つのコマンドを実行する。

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

注意点

  • リポジトリサイズが大きいためコマンドの実行には時間がかかります。

参考

update.sh: refuse to update shallow homebrew-core/cask clones. #9383

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?