Skip to content

Commit f3cadbb

Browse files
committed
Fix new Git credential helper
1 parent c46e64f commit f3cadbb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

UET/Redpoint.Uet.Workspace/PhysicalGit/DefaultPhysicalGitCheckout.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ private async Task<IReservation> GetSharedGitDependenciesPath(GitWorkspaceDescri
17381738
{ "GIT_ASK_YESNO", "false" },
17391739
{ "GIT_CONFIG_COUNT", "1" },
17401740
{ "GIT_CONFIG_KEY_0", "credential.helper" },
1741-
{ "GIT_CONFIG_VALUE_0", $"{_gitCredentialHelperProvider.FilePath} {string.Join(' ', _gitCredentialHelperProvider.Arguments.Select(x => x.LogicalValue))}" },
1741+
{ "GIT_CONFIG_VALUE_0", $"{_gitCredentialHelperProvider.FilePath.Replace(@"\", @"\\", StringComparison.Ordinal)} {string.Join(' ', _gitCredentialHelperProvider.Arguments.Select(x => x.LogicalValue))}" },
17421742
};
17431743
var uriComponents = uri.UserInfo.Split(':', 2);
17441744
var uriHost = uri.Host.Replace(".", "_", StringComparison.Ordinal);

UET/uet/Commands/Internal/GitCredentialHelper/GitCredentialHelperCommand.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,23 @@ public Task<int> ExecuteAsync(InvocationContext context)
6868
}
6969
} while (!string.IsNullOrWhiteSpace(line));
7070

71+
input.TryGetValue("path", out var path);
72+
if (!input.TryGetValue("protocol", out var protocol) ||
73+
!input.TryGetValue("host", out var host))
74+
{
75+
// Not a credential request we can handle.
76+
return Task.FromResult(0);
77+
}
78+
7179
// Attempt to perform credential discovery.
7280
try
7381
{
74-
var credential = _credentialDiscovery.GetGitCredential($"{input["protocol"]}://{input["host"]}/{input["path"]}");
82+
var credential = _credentialDiscovery.GetGitCredential($"{protocol}://{host}/{path}");
7583
if (!string.IsNullOrWhiteSpace(credential.Username) &&
7684
!string.IsNullOrWhiteSpace(credential.Password))
7785
{
78-
Console.WriteLine($"protocol={input["protocol"]}");
79-
Console.WriteLine($"host={input["host"]}");
86+
Console.WriteLine($"protocol={protocol}");
87+
Console.WriteLine($"host={host}");
8088
Console.WriteLine($"username={credential.Username}");
8189
Console.WriteLine($"password={credential.Password}");
8290

0 commit comments

Comments
 (0)