Skip to content

Commit dc1edca

Browse files
authored
Fix app path name of Windows dropping file extension (#1181)
During some refactoring we accidentially introduced an error in the 'app path' on the CommandContext`; rather than trimming the file extension off (for detection of the old executable name on Windows) on a local copy, we are now updating the app wide copy! Only mutate a local copy.
2 parents fc4fbae + 35f16af commit dc1edca

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/shared/Git-Credential-Manager/Program.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,17 @@ public static void Main(string[] args)
5252
//
5353
// On UNIX systems we do the same check, except instead of a copy we use a symlink.
5454
//
55-
if (!string.IsNullOrWhiteSpace(context.ApplicationPath))
55+
string appPath = context.ApplicationPath;
56+
if (!string.IsNullOrWhiteSpace(appPath))
5657
{
5758
// Trim any (.exe) file extension if we're on Windows
5859
// Note that in some circumstances (like being called by Git when config is set
5960
// to just `helper = manager-core`) we don't always have ".exe" at the end.
60-
if (PlatformUtils.IsWindows() && context.ApplicationPath.EndsWith(".exe",
61-
StringComparison.OrdinalIgnoreCase))
61+
if (PlatformUtils.IsWindows() && appPath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
6262
{
63-
context.ApplicationPath = context.ApplicationPath
64-
.Substring(0, context.ApplicationPath.Length - 4);
63+
appPath = appPath.Substring(0, appPath.Length - 4);
6564
}
66-
if (context.ApplicationPath.EndsWith("git-credential-manager-core",
67-
StringComparison.OrdinalIgnoreCase))
65+
if (appPath.EndsWith("git-credential-manager-core", StringComparison.OrdinalIgnoreCase))
6866
{
6967
context.Streams.Error.WriteLine(
7068
"warning: git-credential-manager-core was renamed to git-credential-manager");

0 commit comments

Comments
 (0)