Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Powershell 5 compatibility #4

Merged
merged 1 commit into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lazy-posh-git.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Copyright = '(c) Christoph Bergmeister. All rights reserved.'
Description = 'Proxy command around Set-Location and its aliases to defer import of posh-git until one is in a git directory.'

# Minimum version of the PowerShell engine required by this module
PowerShellVersion = '7.0'
PowerShellVersion = '5.0'

# Name of the PowerShell host required by this module
# PowerShellHostName = ''
Expand Down
3 changes: 2 additions & 1 deletion lazy-posh-git.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ function Set-Location {
}
if (Test-Path (Join-Path $PWD.Path '.git')) {
Import-Module posh-git
if (Test-Path $PostImportScriptPath) {
# The first condition helps to prevent ParameterBindingException on PowerShell 5
if ($PostImportScriptPath -and $(Test-Path $PostImportScriptPath)) {
& $PostImportScriptPath
}
}
Expand Down