Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 086a089

Browse files
committed
Merge fixes/mac-path-variable into stanley/0.31-rc
2 parents 35f0289 + 5562b63 commit 086a089

File tree

3 files changed

+23
-32
lines changed

3 files changed

+23
-32
lines changed

src/GitHub.Api/Application/ApplicationManagerBase.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,26 @@ public void Run(bool firstRun)
5353
{
5454
Logger.Trace("Run - CurrentDirectory {0}", NPath.CurrentDirectory);
5555

56-
ITask<string> getMacEnvironmentPathTask;
56+
ITask<string> setExistingEnvironmentPath;
5757
if (Environment.IsMac)
5858
{
59-
getMacEnvironmentPathTask = new SimpleProcessTask(CancellationToken, "bash".ToNPath(), "-c \"/usr/libexec/path_helper\"")
60-
.Configure(ProcessManager)
59+
setExistingEnvironmentPath = new SimpleProcessTask(CancellationToken, "bash".ToNPath(), "-c \"/usr/libexec/path_helper\"")
60+
.Configure(ProcessManager, dontSetupGit: true)
61+
.Catch(e => true) // make sure this doesn't throw if the task fails
6162
.Then((success, path) => success ? path.Split(new[] { "\"" }, StringSplitOptions.None)[1] : null);
6263
}
6364
else
6465
{
65-
getMacEnvironmentPathTask = new FuncTask<string>(CancellationToken, () => null);
66+
setExistingEnvironmentPath = new FuncTask<string>(CancellationToken, () => null);
6667
}
6768

68-
var setMacEnvironmentPathTask = getMacEnvironmentPathTask.Then((_, path) => {
69+
setExistingEnvironmentPath.OnEnd += (t, path, success, ex) => {
6970
if (path != null)
7071
{
71-
Logger.Trace("Mac Environment Path Original:{0} Updated:{1}", Environment.Path, path);
72+
Logger.Trace("Existing Environment Path Original:{0} Updated:{1}", Environment.Path, path);
7273
Environment.Path = path;
7374
}
74-
});
75+
};
7576

7677
var initEnvironmentTask = new ActionTask<NPath>(CancellationToken,
7778
(_, path) => InitializeEnvironment(path))
@@ -80,7 +81,7 @@ public void Run(bool firstRun)
8081
isBusy = true;
8182

8283
var octorunInstaller = new OctorunInstaller(Environment, TaskManager);
83-
var setupTask = setMacEnvironmentPathTask.Then(octorunInstaller.SetupOctorunIfNeeded());
84+
var setupTask = setExistingEnvironmentPath.Then(octorunInstaller.SetupOctorunIfNeeded());
8485

8586
var initializeGitTask = new FuncTask<NPath>(CancellationToken, () =>
8687
{

src/GitHub.Api/Git/GitClient.cs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ public GitClient(IEnvironment environment, IProcessManager processManager, Cance
112112

113113
public ITask<ValidateGitInstallResult> ValidateGitInstall(NPath path, bool isCustomGit)
114114
{
115-
if (!path.FileExists())
116-
{
117-
return new FuncTask<ValidateGitInstallResult>(TaskEx.FromResult(new ValidateGitInstallResult(false, null, null)));
118-
}
119-
120115
Version gitVersion = null;
121116
Version gitLfsVersion = null;
122117

@@ -125,25 +120,20 @@ public ITask<ValidateGitInstallResult> ValidateGitInstall(NPath path, bool isCus
125120
gitVersion?.CompareTo(Constants.MinimumGitVersion) >= 0 &&
126121
gitLfsVersion?.CompareTo(Constants.MinimumGitLfsVersion) >= 0,
127122
gitVersion, gitLfsVersion));
128-
129-
var gitLfsVersionTask = new GitLfsVersionTask(cancellationToken)
130-
.Configure(processManager, path, dontSetupGit: isCustomGit);
131-
132-
gitLfsVersionTask
133-
.Then((result, version) => {return gitLfsVersion = version;})
134-
.Then(endTask, taskIsTopOfChain: true);
135-
136-
gitLfsVersionTask.Then(endTask, TaskRunOptions.OnFailure, taskIsTopOfChain:true);
137-
138-
var gitVersionTask = new GitVersionTask(cancellationToken)
139-
.Configure(processManager, path, dontSetupGit: isCustomGit);
140-
141-
gitVersionTask
142-
.Then((result, version) => { return gitVersion = version; })
143-
.Then(gitLfsVersionTask, taskIsTopOfChain: true);
144-
145-
gitVersionTask.Then(endTask, TaskRunOptions.OnFailure, taskIsTopOfChain:true);
146123

124+
if (path.FileExists())
125+
{
126+
var gitLfsVersionTask = new GitLfsVersionTask(cancellationToken)
127+
.Configure(processManager, path, dontSetupGit: isCustomGit);
128+
gitLfsVersionTask.OnEnd += (t, v, _, __) => gitLfsVersion = v;
129+
var gitVersionTask = new GitVersionTask(cancellationToken)
130+
.Configure(processManager, path, dontSetupGit: isCustomGit);
131+
gitVersionTask.OnEnd += (t, v, _, __) => gitVersion = v;
132+
133+
gitVersionTask
134+
.Then(gitLfsVersionTask)
135+
.Finally(endTask);
136+
}
147137
return endTask;
148138
}
149139

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/GitPathView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private void ValidateAndSetGitInstallPath(string value)
270270
gitVersionErrorMessage = null;
271271

272272
GitClient.ValidateGitInstall(value.ToNPath(), true)
273-
.FinallyInUI((success, exception, result) =>
273+
.ThenInUI((success, result) =>
274274
{
275275
if (!success)
276276
{

0 commit comments

Comments
 (0)