From 8651bc65eb0101c2bac7eaf00c79991b39c8fdd8 Mon Sep 17 00:00:00 2001 From: Per Westerlund Date: Sat, 3 Oct 2020 10:00:50 +0200 Subject: [PATCH] If abbreviating git dir, display correct path on a bare repo --- src/Utils.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ":"