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

Commit 7d44210

Browse files
Fixing my mistakes
1 parent f981958 commit 7d44210

File tree

4 files changed

+18
-25
lines changed

4 files changed

+18
-25
lines changed

src/GitHub.Api/ApplicationManagerBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private async Task RunInternal()
103103
{
104104
await ThreadingHelper.SwitchToThreadAsync();
105105

106-
var gitSetup = new GitSetup(Environment, ProcessManager, FileSystem, CancellationToken);
106+
var gitSetup = new GitSetup(Environment, FileSystem, CancellationToken);
107107
var expectedPath = gitSetup.GitInstallationPath;
108108

109109
var setupDone = await gitSetup.SetupIfNeeded(

src/GitHub.Api/GitSetup.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,24 @@ namespace GitHub.Unity
66
{
77
class GitSetup
88
{
9-
private readonly CancellationToken cancellationToken;
109
private readonly IEnvironment environment;
10+
private readonly CancellationToken cancellationToken;
1111
private readonly GitInstaller gitInstaller;
12-
private readonly IProcessManager processManager;
12+
public NPath GitInstallationPath { get; private set; }
13+
public NPath GitExecutablePath { get; private set; }
1314

14-
public GitSetup(IEnvironment environment, IProcessManager processManager, IFileSystem fileSystem,
15-
CancellationToken cancellationToken)
15+
public GitSetup(IEnvironment environment, IFileSystem fileSystem, CancellationToken cancellationToken)
1616
{
1717
this.environment = environment;
18-
this.processManager = processManager;
1918
this.cancellationToken = cancellationToken;
2019
gitInstaller = new GitInstaller(environment, fileSystem, cancellationToken);
2120
GitInstallationPath = gitInstaller.PackageDestinationDirectory;
2221
GitExecutablePath = gitInstaller.GitDestinationPath;
2322
}
2423

25-
public async Task<bool> SetupIfNeeded(IProgress<float> percentage = null, IProgress<long> timeRemaining = null)
24+
public Task<bool> SetupIfNeeded(IProgress<float> percentage = null, IProgress<long> timeRemaining = null)
2625
{
27-
var setupIfNeeded = await gitInstaller.SetupIfNeeded(percentage, timeRemaining);
28-
29-
return setupIfNeeded;
26+
return gitInstaller.SetupIfNeeded(percentage, timeRemaining);
3027
}
31-
32-
public NPath GitInstallationPath { get; private set; }
33-
public NPath GitExecutablePath { get; private set; }
3428
}
35-
}
29+
}

src/IntegrationTests/BaseGitEnvironmentTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ protected void InitializeEnvironment(NPath repoPath)
1414
UnityProjectPath = repoPath
1515
};
1616

17-
Platform = new Platform(Environment, FileSystem, new TestUIDispatcher());
18-
GitEnvironment = Platform.GitEnvironment;
19-
ProcessManager = new ProcessManager(Environment, GitEnvironment);
20-
21-
var gitSetup = new GitSetup(Environment, ProcessManager, FileSystem, CancellationToken.None);
17+
var gitSetup = new GitSetup(Environment, FileSystem, CancellationToken.None);
2218
gitSetup.SetupIfNeeded().Wait();
2319

2420
Environment.GitExecutablePath = gitSetup.GitExecutablePath;
2521

2622
FileSystem.SetCurrentDirectory(repoPath);
23+
24+
Platform = new Platform(Environment, FileSystem, new TestUIDispatcher());
25+
GitEnvironment = Platform.GitEnvironment;
26+
ProcessManager = new ProcessManager(Environment, GitEnvironment);
2727
Platform.Initialize(ProcessManager);
2828

2929
Environment.UnityProjectPath = repoPath;

src/IntegrationTests/Git/GitSetupTests.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ public void InstallGit()
1414
{
1515
var environmentPath = NPath.CreateTempDirectory("integration-test-environment");
1616
var environment = new IntegrationTestEnvironment(SolutionDirectory, environmentPath);
17-
18-
var platform = new Platform(environment, FileSystem, new TestUIDispatcher());
19-
var gitEnvironment = platform.GitEnvironment;
20-
var processManager = new ProcessManager(environment, gitEnvironment);
21-
22-
var gitSetup = new GitSetup(environment, processManager, FileSystem, CancellationToken.None);
17+
var gitSetup = new GitSetup(environment, FileSystem, CancellationToken.None);
2318
var expectedPath = gitSetup.GitInstallationPath;
2419

2520
var setupDone = false;
@@ -56,6 +51,10 @@ public void InstallGit()
5651
setupDone.Should().BeFalse ();
5752
}
5853

54+
var platform = new Platform(environment, FileSystem, new TestUIDispatcher());
55+
var gitEnvironment = platform.GitEnvironment;
56+
var processManager = new ProcessManager(environment, gitEnvironment);
57+
5958
var gitBranches = processManager.GetGitBranches(TestRepoMasterDirtyUnsynchronized, environment.GitExecutablePath);
6059

6160
gitBranches.Should().BeEquivalentTo(

0 commit comments

Comments
 (0)