-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Ignore Homebrew Git shim #731
Ignore Homebrew Git shim #731
Conversation
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.
A few comments on using sudo -E
instead and caching the ignore list.
src/shared/Core/EnvironmentBase.cs
Outdated
return TryLocateExecutable(program, new List<string>(), out path); | ||
} | ||
|
||
public bool TryLocateExecutable(string program, List<string> pathsToIgnore, out string path) |
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.
Make this method protected virtual
and accept an ICollection<string>
instead
public bool TryLocateExecutable(string program, List<string> pathsToIgnore, out string path) | |
protected virtual bool TryLocateExecutable(string program, ICollection<string> pathsToIgnore, out string path) |
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.
The UT started complaining with protected
so I went with internal
instead. Let me know if there's a better solution, though.
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.
Ahh right, yes, the UT calls this directly. You could also try protected internal
; internal
so the UT can call it and protected
so only subclasses need to access it from non-test code.
Not important thought - more a nit 😁
Add ability to ignore specified paths when searching the PATH for an executable.
Ignore Homebrew shim to ensure the user's installed version of Git is called during `brew uninstall` (instead of the shim). Note that this involves explicitly passing the HOMEBREW_PREFIX environment variable, since the `sudo -u `/usr/bin/logname` "$GCMBIN" unconfigure` command does not inherit it.
Add a unit test to verify ignoring paths when searching the PATH for executables works as expected.
e23c24c
to
f39343b
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.
src/shared/Core/EnvironmentBase.cs
Outdated
return TryLocateExecutable(program, new List<string>(), out path); | ||
} | ||
|
||
public bool TryLocateExecutable(string program, List<string> pathsToIgnore, out string path) |
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.
Ahh right, yes, the UT calls this directly. You could also try protected internal
; internal
so the UT can call it and protected
so only subclasses need to access it from non-test code.
Not important thought - more a nit 😁
Users running
brew uninstall
orbrew upgrade
currently see the following message (indicating that the operation wasn't fully successful):This is because GCM is finding the Homebrew Git shim on the PATH and calling it instead of the user's Git installation. Specifying that we should ignore the Homebrew shim when attempting to locate the Git executable on the PATH resolves the issue.
Fixes #676.