diff --git a/src/Utils.ps1 b/src/Utils.ps1 index 3756a84d6..7c4ca7249 100644 --- a/src/Utils.ps1 +++ b/src/Utils.ps1 @@ -295,8 +295,8 @@ function Get-PromptPath { # Look up the git root if ($abbrevGitDir) { $gitPath = Get-GitDirectory - # Up one level from `.git` - if ($gitPath) { $gitPath = Split-Path $gitPath -Parent } + # Up one level from `.git` if inside git directory + if ($gitPath -and $gitPath.EndsWith(".git")) { $gitPath = Split-Path $gitPath -Parent } } # Abbreviate path under a git repository as ":"