1
0
Форкнуть 0

cli-shared: optionally read actual-url from input

Read the request's "actual URL" from the input stream. To enable easier development debugging when setting the `OperationArguments.GitRemoteHttpCommandLine` value without having to execute "git-remote-http(s)" prior to GCM being started.
This commit is contained in:
J Wyman ∞ 2018-06-25 15:12:40 -04:00
Родитель a08dd15035
Коммит 6fa4bf033c
1 изменённых файлов: 26 добавлений и 3 удалений

Просмотреть файл

@ -532,6 +532,13 @@ namespace Microsoft.Alm.Cli
{
password = pair[1];
}
// This is a GCM only addition to the Git-Credential specification. The intent is to
// facilitate debugging without the need for running git.exe to debug git-remote-http(s)
// command line values.
else if ("_url".Equals(pair[0], StringComparison.Ordinal))
{
_gitRemoteHttpCommandLine = pair[1];
}
}
}
}
@ -725,10 +732,26 @@ namespace Microsoft.Alm.Cli
{
string[] parts = _gitRemoteHttpCommandLine.Split(' ');
if (parts.Length == 3 && Uri.TryCreate(parts[2], UriKind.Absolute, out Uri uri))
switch(parts.Length)
{
actualUrl = uri.ToString();
}
case 1:
{
if (Uri.TryCreate(parts[0], UriKind.Absolute, out Uri uri))
{
actualUrl = uri.ToString();
}
}
break;
case 3:
{
if (Uri.TryCreate(parts[2], UriKind.Absolute, out Uri uri))
{
actualUrl = uri.ToString();
}
}
break;
}
}
// Create the target URI object.