ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
20.32k stars 1.37k forks source link

fix(core): Search for Git executable instead of any cmdlet #5979

Closed MatejKafka closed 4 weeks ago

MatejKafka commented 1 month ago

Motivation and Context

Before this commit, if a user had a custom alias or function for git specified in their PowerShell profile, Get-HelperPath would return path to the PowerShell module where the function is defined instead of path to the actual Git binary.

How Has This Been Tested?

Tested interactively, the code seems reasonably obvious to me. To test the fix, run the following snippet:

New-Module -Script {function git {}}
scoop update

Without this PR, the invocation results in the folowing error:

> scoop update
&: D:\_custom\scoop\app\apps\scoop\current\lib\core.ps1:273
Line |
 273 |          return & $git @ArgumentList
     |                   ~~~~
     | The term '__DynamicModule_cbe178d9-14c2-494d-8004-fbdc292d59d2' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was
     | included, verify that the path is correct and try again.

Checklist:

niheaven commented 1 month ago

Please use a branch other than develop and update the changlog.

MatejKafka commented 1 month ago

Please use a branch other than develop and update the changlog.

Added a changelog entry. What branch should I use? The PR guidelines explicitly say to target develop.

niheaven commented 1 month ago

I mean your local branch. You should create a new branch and make PR from that branch.

MatejKafka commented 4 weeks ago

Whatever. https://github.com/ScoopInstaller/Scoop/pull/5998