-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Check for both shallow clones at the same time. #9501
Check for both shallow clones at the same time. #9501
Conversation
|
I don't like empty lines in the output. The following produces a better result (suppresses empty lines) but I can't say that I'm a big fan of how this code looks so let's see what other maintainers think about it. [[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core/.git/shallow" ]] && SHALLOW_CORE=1
[[ -f "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask/.git/shallow" ]] && SHALLOW_CASK=1
if [[ -n $SHALLOW_CORE || -n $SHALLOW_CASK ]]
then
odie <<EOS
${SHALLOW_CORE:+homebrew-core is a shallow clone.${SHALLOW_CASK:+
}}${SHALLOW_CASK:+\
homebrew-cask is a shallow clone.}
To \`brew update\`, first run:
${SHALLOW_CORE:+git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" fetch --unshallow${SHALLOW_CASK:+
}}${SHALLOW_CASK:+\
git -C "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-cask" fetch --unshallow}
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!
EOS
fi |
Thanks for opening a PR @rgant ❤️
Agreed 👍🏻 |
I would imagine that 99.999 times out of 100 it would be both repos are shallow or neither are (once this message is the default instructing you to fix both at the same time). So making it look nice when there is only one feels like polishing an edge case. But if you want to do it then I've added my way of doing that.
|
Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @rgant! Looks great!
Thanks so much for your first contribution! Without people like you submitting PRs we couldn't run this project. You rock, @rgant! |
brew style
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?I find it confusing that the first time you fail because of an shallow clone issue it only tells you about one of the shallow clones. Since the second one is very similarly named, for example #9420.
This is a terrible way to do it, but since I am completely unfamiliar with how brew is constructed it is a straightforward example of the way I think it should work.