Skip to content

Commit fb69b09

Browse files
committed
If abbreviating git dir, display correct path on a bare repo
1 parent d94feed commit fb69b09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Utils.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ function Get-PromptPath {
295295
# Look up the git root
296296
if ($abbrevGitDir) {
297297
$gitPath = Get-GitDirectory
298-
# Up one level from `.git`
299-
if ($gitPath) { $gitPath = Split-Path $gitPath -Parent }
298+
# Up one level from `.git` if inside git directory
299+
if ($gitPath -and $gitPath.EndsWith(".git")) { $gitPath = Split-Path $gitPath -Parent }
300300
}
301301

302302
# Abbreviate path under a git repository as "<repo-name>:<relative-path>"

0 commit comments

Comments
 (0)