diff --git a/CHANGELOG.md b/CHANGELOG.md index 35f6e20..2f443bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ ### Fixes +* Fix #2191: profile.ps1: CheckGit does not export $gitLoaded * Fix #2192: Set default prompt hooks before loading user profile * Fix #2097, #1899: powershell foreground color changing to green * Fix #1979: Update Clink Completions to 0.3.4 diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index c0dbfb1..4800ec1 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -32,53 +32,13 @@ $moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorActi # Add Cmder modules directory to the autoload path. $CmderModulePath = Join-path $PSScriptRoot "psmodules/" +$CmderFunctions = Join-Path $CmderModulePath "Cmder.ps1" +. $CmderFunctions + if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderModulePath) ){ $env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;") } -function Configure-Git($GIT_INSTALL_ROOT){ - $env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd") - - # Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already - $GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\') - if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin" - } - - # Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already - if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin" - } elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) { - $env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin" - } -} - -$gitLoaded = $false -function Import-Git($Loaded){ - if($Loaded) { return } - $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 -} - -function checkGit($Path) { - if (Test-Path -Path (Join-Path $Path '.git') ) { - $gitLoaded = Import-Git $gitLoaded - Write-VcsStatus - return - } - $SplitPath = split-path $path - if ($SplitPath) { - checkGit($SplitPath) - } -} - try { # Check if git is on PATH, i.e. Git already installed on system Get-command -Name "git" -ErrorAction Stop >$null @@ -97,6 +57,8 @@ if (Get-Module PSReadline -ErrorAction "SilentlyContinue") { } # Pre assign default prompt hooks so the first run of cmder gets a working prompt. +$gitLoaded = $false +$env:gitLoaded = $false [ScriptBlock]$PrePrompt = {} [ScriptBlock]$PostPrompt = {} [ScriptBlock]$CmderPrompt = {