diff --git a/BuildHelpers/Public/Get-BuildVariables.ps1 b/BuildHelpers/Public/Get-BuildVariables.ps1 index 182f27d..7789bd6 100644 --- a/BuildHelpers/Public/Get-BuildVariables.ps1 +++ b/BuildHelpers/Public/Get-BuildVariables.ps1 @@ -69,13 +69,13 @@ function Get-BuildVariables { } $true })] - $GitPath = 'git' + $GitPath ) $Path = ( Resolve-Path $Path ).Path $Environment = Get-Item ENV: if(!$PSboundParameters.ContainsKey('GitPath')) { - $GitPath = (Get-Command $GitPath -ErrorAction SilentlyContinue)[0].Path + $GitPath = (Get-ChildItem ($env:PATH -split ';') -filter git.exe -ErrorAction SilentlyContinue | Select-Object -First 1).Fullname } $WeCanGit = ( (Test-Path $( Join-Path $Path .git )) -and (Get-Command $GitPath -ErrorAction SilentlyContinue) ) diff --git a/BuildHelpers/Public/Invoke-Git.ps1 b/BuildHelpers/Public/Invoke-Git.ps1 index 66aeaa4..7519a67 100644 --- a/BuildHelpers/Public/Invoke-Git.ps1 +++ b/BuildHelpers/Public/Invoke-Git.ps1 @@ -77,14 +77,14 @@ } $true })] - [string]$GitPath = 'git' + [string]$GitPath ) $Path = (Resolve-Path $Path).Path # http://stackoverflow.com/questions/8761888/powershell-capturing-standard-out-and-error-with-start-process $pinfo = New-Object System.Diagnostics.ProcessStartInfo if(!$PSBoundParameters.ContainsKey('GitPath')) { - $GitPath = (Get-Command $GitPath -ErrorAction Stop)[0].Path + $GitPath = (Get-ChildItem ($env:PATH -split ';') -filter git.exe -ErrorAction SilentlyContinue | Select-Object -First 1).Fullname } $pinfo.FileName = $GitPath $Command = $GitPath