@@ -43,16 +43,24 @@ public static void Main(string[] args)
43
43
//
44
44
// On UNIX systems we do the same check, except instead of a copy we use a symlink.
45
45
//
46
- string oldName = PlatformUtils . IsWindows ( )
47
- ? "git-credential-manager-core.exe"
48
- : "git-credential-manager-core" ;
49
46
50
- if ( appPath ? . EndsWith ( oldName , StringComparison . OrdinalIgnoreCase ) ?? false )
47
+ if ( ! string . IsNullOrWhiteSpace ( appPath ) )
51
48
{
52
- context . Streams . Error . WriteLine (
53
- "warning: git-credential-manager-core was renamed to git-credential-manager" ) ;
54
- context . Streams . Error . WriteLine (
55
- $ "warning: see { Constants . HelpUrls . GcmExecRename } for more information") ;
49
+ // Trim any (.exe) file extension if we're on Windows
50
+ // Note that in some circumstances (like being called by Git when config is set
51
+ // to just `helper = manager-core`) we don't always have ".exe" at the end.
52
+ if ( PlatformUtils . IsWindows ( ) && appPath . EndsWith ( ".exe" , StringComparison . OrdinalIgnoreCase ) )
53
+ {
54
+ appPath = appPath . Substring ( 0 , appPath . Length - 4 ) ;
55
+ }
56
+
57
+ if ( appPath . EndsWith ( "git-credential-manager-core" , StringComparison . OrdinalIgnoreCase ) )
58
+ {
59
+ context . Streams . Error . WriteLine (
60
+ "warning: git-credential-manager-core was renamed to git-credential-manager" ) ;
61
+ context . Streams . Error . WriteLine (
62
+ $ "warning: see { Constants . HelpUrls . GcmExecRename } for more information") ;
63
+ }
56
64
}
57
65
58
66
// Register all supported host providers at the normal priority.
0 commit comments