-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
automatically repair tap with renamed main branch #19196
base: master
Are you sure you want to change the base?
Conversation
550786f
to
f304f80
Compare
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.
Looks good so far! Are there any performance implications for brew update
in the non-repair case? Can test this out with hyperfine
.
This should cost roughly 10ms per tap, because we're running The extra The use of this cache was removed in the first commit on this branch. I just removed the creation of this cache in my latest commit/push because it's an unused variable. If you're concerned about the time savings I could revert the last commit and use a temp file to track any renames; then we could invalidate the cache only when we need to. This would save some time, at the cost of complexity. Any thoughts? I'm happy to implement this either way, but I slightly prefer it in the current state I've committed: the cache I removed provided a tiny time savings and made code harder to read and debug. |
Feels like it might be nicer/safer to do this rename not in a subshell and set some marker file indicating that we don't need to check it again every Or is this the caching you're referring to above? In my mind (correct me if wrong!) the ideal flow would be something like:
Thoughts? Thanks for the PR! |
bf0506d
to
88629f9
Compare
- without named_args, repair all taps (behavior unchanged) - with named_args, only repair listed taps - add --verbose option
Refactor error handling. Move to a function.
- automatically run `brew tap --repair` when we detect it's needed - don't pass list of taps to repair taps to update-report; no longer since update repairs them
88629f9
to
e23db43
Compare
@MikeMcQuaid, that's an accurate summary of the workflow. That's what we were already doing before this PR, except we were printing an error annoucing that we discovered the rename rather than fixing it. Latest push is a refactor to:
To be clear, we're not running any extra code in the base case (when taps are reachable and not renamed). The rename check was always taken care of in error handling, and nothing in this PR changes that. |
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.
Thanks @rrotter! Just to set expectations: because this is update code and any breakage here potentially requires manual intervention for all Homebrew users: I'm going to be very conservative with review. Apologies for that.
HOMEBREW_MISSING_REMOTE_REF_DIRS="$(cat "${missing_remote_ref_dirs_file}")" | ||
while IFS='' read -r DIR | ||
do | ||
brew tap --repair ${HOMEBREW_VERBOSE+--verbose} "${DIR#"${HOMEBREW_LIBRARY}"/Taps/}" |
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.
Sorry if I didn't say this clearly enough before: we can't/shouldn't call brew tap
inside brew update
like this. Instead, this should perform the same operations that brew tap --repair
would but in raw Bash.
@@ -327,6 +327,48 @@ EOS | |||
trap - SIGINT | |||
} | |||
|
|||
fetch_tags() { |
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.
Is this function extraction essential to landing this PR? As-is: it's very hard to visually differentiate what changes have been made here. It might be best to extract this into the separate with zero logic changes in a separate PR that lands before this one.
As a homebrew user, I'd expect nothing less. Thank you for your forthrightness. (I'll follow up on the code comments later today or over the weekend) |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?First step to fixing #17296.
We already have robust support for both detecting and fixing taps with renamed upstream HEAD. This puts those two together.
brew tap --repair foo/bar
update.sh
, runbrew tap --repair
on any taps where we detect renamed upstream HEADgit fetch
attempt, only if we detect renamebrew tap --repair
, retrygit fetch