Skip to content

Commit

Permalink
Make sure we install Git before trying to find it on the PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que committed Nov 15, 2024
1 parent 0da44b0 commit 0a9bcd6
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,16 @@ public async Task PrepareGitWorkspaceAsync(
GitWorkspaceDescriptor descriptor,
CancellationToken cancellationToken)
{
// Automatically upgrade Git if needed.
await UpgradeSystemWideGitIfPossibleAsync().ConfigureAwait(false);

// Ensure Git is on our PATH (this fixes up the PATH variable if we just installed Git via UpgradeSystemWideGitIfPossibleAsync).
await EnsureGitIsOnProcessPATH().ConfigureAwait(false);

// Ensure Git is new enough.
await EnsureGitIsNewEnoughVersionAsync().ConfigureAwait(false);

// Find Git and set up environment variables.
var git = await _pathResolver.ResolveBinaryPath("git").ConfigureAwait(false);
var gitEnvs = new Dictionary<string, string>
{
Expand All @@ -1781,15 +1791,6 @@ public async Task PrepareGitWorkspaceAsync(
EnableSubmoduleSupport = descriptor.BuildType == GitWorkspaceDescriptorBuildType.Generic,
};

// Automatically upgrade Git if needed.
await UpgradeSystemWideGitIfPossibleAsync().ConfigureAwait(false);

// Ensure Git is on our PATH (this fixes up the PATH variable if we just installed Git via UpgradeSystemWideGitIfPossibleAsync).
await EnsureGitIsOnProcessPATH().ConfigureAwait(false);

// Ensure Git is new enough.
await EnsureGitIsNewEnoughVersionAsync().ConfigureAwait(false);

// Initialize the Git repository if needed.
await InitGitWorkspaceIfNeededAsync(repositoryPath, descriptor, gitContext, cancellationToken).ConfigureAwait(false);

Expand Down

0 comments on commit 0a9bcd6

Please sign in to comment.