From 9d6ec5352cd783f14be8b4193b6468885300151f Mon Sep 17 00:00:00 2001 From: Jessica Schumaker Date: Tue, 25 Sep 2018 14:35:00 -0400 Subject: [PATCH] Set config to useHttpPath=true Hostname is no longer sufficent for VSTS authentication. VSTS now requires dev.azure.com/account to determine the tenant. By setting useHttpPath, credential managers will get the path which contains the account as the first parameter. They can then use this information for auth appropriately. --- GVFS/GVFS.Common/Git/GitConfigSetting.cs | 1 + GVFS/GVFS.Common/Git/GitProcess.cs | 2 +- GVFS/GVFS.UnitTests/Git/GitAuthenticationTests.cs | 2 +- GVFS/GVFS/CommandLine/GVFSVerb.cs | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/GVFS/GVFS.Common/Git/GitConfigSetting.cs b/GVFS/GVFS.Common/Git/GitConfigSetting.cs index 12ea0eb23d..fc836d2348 100644 --- a/GVFS/GVFS.Common/Git/GitConfigSetting.cs +++ b/GVFS/GVFS.Common/Git/GitConfigSetting.cs @@ -6,6 +6,7 @@ public class GitConfigSetting { public const string CoreVirtualizeObjectsName = "core.virtualizeobjects"; public const string CoreVirtualFileSystemName = "core.virtualfilesystem"; + public const string CredentialUseHttpPath = "credential.useHttpPath"; public GitConfigSetting(string name, params string[] values) { diff --git a/GVFS/GVFS.Common/Git/GitProcess.cs b/GVFS/GVFS.Common/Git/GitProcess.cs index 47ad144e83..5c3bba3cde 100644 --- a/GVFS/GVFS.Common/Git/GitProcess.cs +++ b/GVFS/GVFS.Common/Git/GitProcess.cs @@ -112,7 +112,7 @@ public virtual bool TryGetCredentials( using (ITracer activity = tracer.StartActivity("TryGetCredentials", EventLevel.Informational)) { Result gitCredentialOutput = this.InvokeGitAgainstDotGitFolder( - "credential fill", + "-c " + GitConfigSetting.CredentialUseHttpPath + "=true credential fill", stdin => stdin.Write("url=" + repoUrl + "\n\n"), parseStdOutLine: null); diff --git a/GVFS/GVFS.UnitTests/Git/GitAuthenticationTests.cs b/GVFS/GVFS.UnitTests/Git/GitAuthenticationTests.cs index abe2bac1ac..bc22fd7c13 100644 --- a/GVFS/GVFS.UnitTests/Git/GitAuthenticationTests.cs +++ b/GVFS/GVFS.UnitTests/Git/GitAuthenticationTests.cs @@ -194,7 +194,7 @@ private MockGitProcess GetGitProcess() int revocations = 0; gitProcess.SetExpectedCommandResult( - "credential fill", + "-c credential.useHttpPath=true credential fill", () => new GitProcess.Result("username=username\r\npassword=password" + revocations + "\r\n", string.Empty, GitProcess.Result.SuccessCode)); gitProcess.SetExpectedCommandResult( diff --git a/GVFS/GVFS/CommandLine/GVFSVerb.cs b/GVFS/GVFS/CommandLine/GVFSVerb.cs index 325e2dceeb..d001699c35 100644 --- a/GVFS/GVFS/CommandLine/GVFSVerb.cs +++ b/GVFS/GVFS/CommandLine/GVFSVerb.cs @@ -92,6 +92,7 @@ public static bool TrySetRequiredGitConfigSettings(Enlistment enlistment) { GitConfigSetting.CoreVirtualizeObjectsName, "true" }, { GitConfigSetting.CoreVirtualFileSystemName, Paths.ConvertPathToGitFormat(GVFSConstants.DotGit.Hooks.VirtualFileSystemPath) }, { "core.hookspath", expectedHooksPath }, + { GitConfigSetting.CredentialUseHttpPath, "true" }, { "credential.validate", "false" }, { "diff.autoRefreshIndex", "false" }, { "gc.auto", "0" },