From 35b90f988999cf34f581574d7885d258050e817b Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Thu, 17 Nov 2022 00:30:21 -0300 Subject: [PATCH] Bump GCM to latest stable v2.0.785 See https://github.com/GitCredentialManager/git-credential-manager/releases/tag/v2.0.785 --- .gitmodules | 7 +++--- external/.editorconfig | 3 +++ external/gcm | 1 + gcm | 1 - gcm.sln | 56 ++++++++++++++++++++++++------------------ src/ApplicationBase.cs | 37 ++++++++++++++++++++++++++++ src/Program.cs | 5 ++-- src/gcm.csproj | 10 ++++---- 8 files changed, 84 insertions(+), 36 deletions(-) create mode 100644 external/.editorconfig create mode 160000 external/gcm delete mode 160000 gcm create mode 100644 src/ApplicationBase.cs diff --git a/.gitmodules b/.gitmodules index a665e34..f8d0ff2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ -[submodule "gcm"] - path = gcm - url = https://github.com/microsoft/Git-Credential-Manager-Core - branch = master +[submodule "external/gcm"] + path = external/gcm + url = https://github.com/GitCredentialManager/git-credential-manager diff --git a/external/.editorconfig b/external/.editorconfig new file mode 100644 index 0000000..a5dc0f4 --- /dev/null +++ b/external/.editorconfig @@ -0,0 +1,3 @@ +# ignore submodule +[**] +generated_code = true \ No newline at end of file diff --git a/external/gcm b/external/gcm new file mode 160000 index 0000000..cf5a693 --- /dev/null +++ b/external/gcm @@ -0,0 +1 @@ +Subproject commit cf5a6933a62e1c1943cf4a76b25d22ff4f9df0c2 diff --git a/gcm b/gcm deleted file mode 160000 index 39efe03..0000000 --- a/gcm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 39efe035f9ad9db40406c63b69f7a3469e69c520 diff --git a/gcm.sln b/gcm.sln index fcbe939..13c630a 100644 --- a/gcm.sln +++ b/gcm.sln @@ -5,20 +5,22 @@ VisualStudioVersion = 17.0.31423.177 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "gcm", "src\gcm.csproj", "{1A422BD3-3F70-42E2-8440-BC5849D98C4F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHub", "gcm\src\shared\GitHub\GitHub.csproj", "{C66EF899-8746-432B-9197-B46E8A24D766}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AzureRepos", "gcm\src\shared\Microsoft.AzureRepos\Microsoft.AzureRepos.csproj", "{7A4835F8-D262-44AC-9847-A7A9A795B3DB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Git.CredentialManager", "gcm\src\shared\Microsoft.Git.CredentialManager\Microsoft.Git.CredentialManager.csproj", "{49FAAEA6-11B1-4C94-BCCC-73ABC5081F82}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atlassian.Bitbucket", "gcm\src\shared\Atlassian.Bitbucket\Atlassian.Bitbucket.csproj", "{176D8871-96AF-487E-95FF-F7C6019F9C2D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{41F74DE7-F58C-4F02-8D89-52851C4932F9}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig readme.md = readme.md EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "external\gcm\src\shared\Core\Core.csproj", "{007ECD8D-CA95-4E0E-A41B-2E5760F0C1D5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atlassian.Bitbucket", "external\gcm\src\shared\Atlassian.Bitbucket\Atlassian.Bitbucket.csproj", "{17315697-B03C-4013-B509-EDBCC90C404E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitHub", "external\gcm\src\shared\GitHub\GitHub.csproj", "{A6D011E2-666F-4D0B-B340-9C4C9AEC391D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AzureRepos", "external\gcm\src\shared\Microsoft.AzureRepos\Microsoft.AzureRepos.csproj", "{6F00F0BF-8270-4173-B16F-DF1553A38294}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "external", "external", "{FA3F47A5-A381-4BD4-9329-B7C2E1A73CB3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,26 +31,32 @@ Global {1A422BD3-3F70-42E2-8440-BC5849D98C4F}.Debug|Any CPU.Build.0 = Debug|Any CPU {1A422BD3-3F70-42E2-8440-BC5849D98C4F}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A422BD3-3F70-42E2-8440-BC5849D98C4F}.Release|Any CPU.Build.0 = Release|Any CPU - {C66EF899-8746-432B-9197-B46E8A24D766}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C66EF899-8746-432B-9197-B46E8A24D766}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C66EF899-8746-432B-9197-B46E8A24D766}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C66EF899-8746-432B-9197-B46E8A24D766}.Release|Any CPU.Build.0 = Release|Any CPU - {7A4835F8-D262-44AC-9847-A7A9A795B3DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7A4835F8-D262-44AC-9847-A7A9A795B3DB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A4835F8-D262-44AC-9847-A7A9A795B3DB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7A4835F8-D262-44AC-9847-A7A9A795B3DB}.Release|Any CPU.Build.0 = Release|Any CPU - {49FAAEA6-11B1-4C94-BCCC-73ABC5081F82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {49FAAEA6-11B1-4C94-BCCC-73ABC5081F82}.Debug|Any CPU.Build.0 = Debug|Any CPU - {49FAAEA6-11B1-4C94-BCCC-73ABC5081F82}.Release|Any CPU.ActiveCfg = Release|Any CPU - {49FAAEA6-11B1-4C94-BCCC-73ABC5081F82}.Release|Any CPU.Build.0 = Release|Any CPU - {176D8871-96AF-487E-95FF-F7C6019F9C2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {176D8871-96AF-487E-95FF-F7C6019F9C2D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {176D8871-96AF-487E-95FF-F7C6019F9C2D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {176D8871-96AF-487E-95FF-F7C6019F9C2D}.Release|Any CPU.Build.0 = Release|Any CPU + {007ECD8D-CA95-4E0E-A41B-2E5760F0C1D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {007ECD8D-CA95-4E0E-A41B-2E5760F0C1D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {007ECD8D-CA95-4E0E-A41B-2E5760F0C1D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {007ECD8D-CA95-4E0E-A41B-2E5760F0C1D5}.Release|Any CPU.Build.0 = Release|Any CPU + {17315697-B03C-4013-B509-EDBCC90C404E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17315697-B03C-4013-B509-EDBCC90C404E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17315697-B03C-4013-B509-EDBCC90C404E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17315697-B03C-4013-B509-EDBCC90C404E}.Release|Any CPU.Build.0 = Release|Any CPU + {A6D011E2-666F-4D0B-B340-9C4C9AEC391D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6D011E2-666F-4D0B-B340-9C4C9AEC391D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6D011E2-666F-4D0B-B340-9C4C9AEC391D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6D011E2-666F-4D0B-B340-9C4C9AEC391D}.Release|Any CPU.Build.0 = Release|Any CPU + {6F00F0BF-8270-4173-B16F-DF1553A38294}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F00F0BF-8270-4173-B16F-DF1553A38294}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F00F0BF-8270-4173-B16F-DF1553A38294}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F00F0BF-8270-4173-B16F-DF1553A38294}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {007ECD8D-CA95-4E0E-A41B-2E5760F0C1D5} = {FA3F47A5-A381-4BD4-9329-B7C2E1A73CB3} + {17315697-B03C-4013-B509-EDBCC90C404E} = {FA3F47A5-A381-4BD4-9329-B7C2E1A73CB3} + {A6D011E2-666F-4D0B-B340-9C4C9AEC391D} = {FA3F47A5-A381-4BD4-9329-B7C2E1A73CB3} + {6F00F0BF-8270-4173-B16F-DF1553A38294} = {FA3F47A5-A381-4BD4-9329-B7C2E1A73CB3} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5B7BEADD-4352-4C67-A70E-60FEC09478AF} EndGlobalSection diff --git a/src/ApplicationBase.cs b/src/ApplicationBase.cs new file mode 100644 index 0000000..910d045 --- /dev/null +++ b/src/ApplicationBase.cs @@ -0,0 +1,37 @@ +using System; +using System.IO; +using System.Reflection; + +namespace DotNet; + +static class ApplicationBase +{ + public static string GetEntryApplicationPath() + { +#if NETFRAMEWORK + // Single file publishing does not exist with .NET Framework so + // we can just use reflection to get the entry assembly path. + return Assembly.GetEntryAssembly().Location; +#else + // Assembly::Location always returns an empty string if the application + // was published as a single file +#pragma warning disable IL3000 + bool isSingleFile = string.IsNullOrEmpty(Assembly.GetEntryAssembly()?.Location); +#pragma warning restore IL3000 + + // Use "argv[0]" to get the full path to the entry executable in + // .NET 5+ when published as a single file. + string[] args = Environment.GetCommandLineArgs(); + string candidatePath = args[0]; + + // If we have not been published as a single file then we must strip the + // ".dll" file extension to get the default AppHost/SuperHost name. + if (!isSingleFile && Path.HasExtension(candidatePath)) + { + return Path.ChangeExtension(candidatePath, null); + } + + return candidatePath; +#endif + } +} diff --git a/src/Program.cs b/src/Program.cs index 29b9d8a..494e2dd 100644 --- a/src/Program.cs +++ b/src/Program.cs @@ -9,9 +9,9 @@ using System.Reflection; using System.Threading.Tasks; using Atlassian.Bitbucket; +using GitCredentialManager; using GitHub; using Microsoft.AzureRepos; -using Microsoft.Git.CredentialManager; namespace gcm { @@ -25,7 +25,8 @@ static Program() Environment.SetEnvironmentVariable("GCM_INTERACTIVE", "never", EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("GIT_TERMINAL_PROMPT", "false", EnvironmentVariableTarget.Process); - var context = new CommandContext(GetApplicationPath()); + var appPath = ApplicationBase.GetEntryApplicationPath(); + var context = new CommandContext(appPath); providers = new IHostProvider[] { new GitHubHostProvider(context), diff --git a/src/gcm.csproj b/src/gcm.csproj index e246a00..737a5ae 100644 --- a/src/gcm.csproj +++ b/src/gcm.csproj @@ -4,7 +4,7 @@ A dotnet global tool for managing Git credentials using the Microsoft Git Credentials Manager Core. Exe - netcoreapp2.1;netcoreapp3.1;net5.0 + net6.0 gcm DotNet @@ -28,10 +28,10 @@ - - - - + + + +