@@ -43,16 +43,24 @@ public static void Main(string[] args)
4343 //
4444 // On UNIX systems we do the same check, except instead of a copy we use a symlink.
4545 //
46- string oldName = PlatformUtils . IsWindows ( )
47- ? "git-credential-manager-core.exe"
48- : "git-credential-manager-core" ;
4946
50- if ( appPath ? . EndsWith ( oldName , StringComparison . OrdinalIgnoreCase ) ?? false )
47+ if ( ! string . IsNullOrWhiteSpace ( appPath ) )
5148 {
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+ }
5664 }
5765
5866 // Register all supported host providers at the normal priority.
0 commit comments