From e18c4407c1cb37fc1bd70353e8ce4b2abf4bd562 Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 10 Jul 2017 16:17:54 -0600 Subject: [PATCH] Search for "git.exe" instead of "git" Passing just "git" to get-command causes the script to fail if you have an alias called "git". For example, I have hub installed (https://github.com/github/hub), which recommends aliasing git=hub. However, after doing this it breaks this posh-git script because `get-command git` returns the new alias which has no path. Running `get-command git` returns: CommandType Name Version Source ----------- ---- ------- ------ Alias git -> hub.exe But `get-command git.exe` returns: CommandType Name Version Source ----------- ---- ------- ------ Application git.exe 2.13.2.1 C:\Program Files\Git\cmd\git.exe --- src/GitUtils.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitUtils.ps1 b/src/GitUtils.ps1 index 0945009f7..20ad1b163 100644 --- a/src/GitUtils.ps1 +++ b/src/GitUtils.ps1 @@ -430,7 +430,7 @@ function Find-Pageant() { # Attempt to guess $program's location. For ssh-agent/ssh-add. function Find-Ssh($program = 'ssh-agent') { Write-Verbose "$program not in path. Trying to guess location." - $gitItem = Get-Command git -Erroraction SilentlyContinue | Get-Item + $gitItem = Get-Command git.exe -Erroraction SilentlyContinue | Get-Item if ($null -eq $gitItem) { Write-Warning 'git not in path' return