From db909451c94943f3d0c916f4865590038ae7b2d9 Mon Sep 17 00:00:00 2001 From: Jackbennett Date: Mon, 10 Oct 2016 12:01:55 +0100 Subject: [PATCH] Version Check the Posh-Git module to allow module autoloading Posh-Git before this release does not export `Write-VcsStatus` thus powershell's autoloading cannot find the reqired module for the function. note that `get-module -listAvailable` can return an array of multiple versions. --- vendor/profile.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index fc0f324..7878ff2 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -49,9 +49,14 @@ try { $gitLoaded = $false function Import-Git($Loaded){ if($Loaded) { return } - if(-not (Get-Module -Name Posh-Git -ListAvailable) ) { + $GitModule = Get-Module -Name Posh-Git -ListAvailable + if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){ + Import-Module Posh-Git > $null + } + if(-not ($GitModule) ) { Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder." } + # Make sure we only run once by alawys returning true return $true }