-
Notifications
You must be signed in to change notification settings - Fork 448
Fixing path variable calculation #659
Fixing path variable calculation #659
Conversation
|
TLDR: I've isolated the problem to how we computer the I'm able to reproduce this on my mac. I have some updated information. Unity/src/GitHub.Api/Platform/ProcessEnvironment.cs Lines 60 to 73 in 0c3b816
I got this... Meanwhile on my normal shell.. (Minus some Ruby/homebrew stuff...) In code I forcibly set that value in place and I was able to initialize the repo. |
|
I did a bit more digging with some log messages. Unity/src/GitHub.Api/Platform/ProcessEnvironment.cs Lines 31 to 37 in e49517f
|
|
On my mac I have git & git-lfs installed via homebrew, which creates a symlink C02L939KF6T6:~ stanleygoldman$ ls -la /usr/local/bin/git
lrwxr-xr-x 1 stanleygoldman admin 28 Mar 29 10:12 /usr/local/bin/git -> ../Cellar/git/2.16.3/bin/gitIf a user attempts to select that path using the file browser, the file browser seems to resolve the symlink and give us the real path. A savvier user might attempts to to save a git path by typing in |
|
So thinking about this further. If we are providing Git to the user, it makes sense that we need to supplement the environment's |
|
This Unity/src/GitHub.Api/Platform/ProcessEnvironment.cs Lines 25 to 26 in e49517f
|
|
There is also no way to go back to the "default" setting. If my comment above is correct, whereby we only modify the |
|
Also, note what happens here with opening a command window on a mac... Unity/src/GitHub.Api/OutputProcessors/ProcessManager.cs Lines 85 to 92 in e49517f
Unity/src/GitHub.Api/Platform/ProcessEnvironment.cs Lines 75 to 79 in e49517f
When running a command through Which explains this scenario... We cannot use LFS when we run commands, but the shell we open is able to. Here is that shell's bash-3.2$ echo $PATH
/usr/bin:/usr::/usr:/usr/bin:/bin:/usr/sbin:/sbin::/Users/stanleygoldman/.rvm/gems/ruby-2.1.5-github/bin:/Users/stanleygoldman/.rvm/gems/ruby-2.1.5-github@global/bin:/Users/stanleygoldman/.rvm/rubies/ruby-2.1.5-github/bin:/Users/stanleygoldman/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/stanleygoldman/.rvm/bin:/Users/stanleygoldman/.rvm/bin |
|
I believe most of the battle is to be fought here. Unity/src/GitHub.Api/OutputProcessors/ProcessManager.cs Lines 32 to 48 in e49517f
Here we choose what executable to run, if none is chosen we choose git. |
|
Also, the "Find Install" function is not working correctly... It does not specify Unity/src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs Lines 122 to 123 in 977b32e
As compared to what happens during mac installation. Unity/src/GitHub.Api/Installer/GitInstaller.cs Lines 44 to 47 in 977b32e
|
…-variable # Conflicts: # src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs
…d-path' into fixes/mac-path-variable
| if (Environment.IsMac) | ||
| { | ||
| getMacEnvironmentPathTask = new SimpleProcessTask(CancellationToken, "bash".ToNPath(), "-c \"/usr/libexec/path_helper\"") | ||
| .Configure(ProcessManager) |
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.
This should probably set dontUseGit: true since we just want to run bash
| { | ||
| getMacEnvironmentPathTask = new SimpleProcessTask(CancellationToken, "bash".ToNPath(), "-c \"/usr/libexec/path_helper\"") | ||
| .Configure(ProcessManager) | ||
| .Then((success, path) => success ? path.Split(new[] { "\"" }, StringSplitOptions.None)[1] : null); |
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.
It's possible that this task will fail, and if it does nothing else will run and the UI will be kinda stuck. In that case, we probably want to have a Catch here returning true so if it fails it doesn't fail the whole chain.
- Fix a bunch of typos - Make sure the download failing doesn't abort the whole process - Install lfs if there is a git but lfs is missing - Fix the download tests to download the real files that we're shipping - Mock the unzipper for the git installer test so it's faster - a bunch of other fixes
The installation state was getting passed into ExtractPortableGit too early - that method needs to have the result of the download tasks
…-more Fix a bunch of stuff in the git installation process


DO NOT MERGE: This is part of #663
Problems
/usr/libexec/path_helperto augment the PATH variable. src.path_helperis executed. As a result the path variables when we open a terminal window does not match the path variables when we are calling Git. Which explains why users were able to rungit lfs ...in the terminal we opened for them when we couldn't do it in code.Fixes
ApplicationManagerBase.Run()we are callingpath_helperif we are on a mac, and updatingEnvironment.Pathwith the result.Fixes: #650
Depends on: