-
-
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
brew.sh: fix handling of dirty git repo #18153
Conversation
We cache the output of `git describe`, but we don't check whether the cached value is valid. This fixes that.
Can you performance bench before and after this change? |
Tiny bit slower, but not much:
Worst-case delay is 14ms (max of |
I can shave about a millisecond off this by using |
This will be slightly more efficient since it can be done in-process.
Using
|
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.
OK seems worth it for correctness
Note that May be worth comparing speed and correctness to checking if |
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! Would like to see reordering but using git diff
is optional if it's slower.
Checking for readability is a cheaper operation that `git diff-index`.
Thanks @carlocab! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?We cache the output of
git describe
, but we don't check whether thecached value is valid.
This fixes that.