Add simple branch name gen for sh and ps1

This commit is contained in:
Ian Craig
2021-05-25 21:03:28 -07:00
parent 9df8f1a92a
commit a5c98d4fe9
2 changed files with 26 additions and 0 deletions

View File

@ -36,6 +36,14 @@ function checkGit($Path) {
if (getGitStatusSetting -eq $true) {
Write-VcsStatus
} else {
$headContent = Get-Content (Join-Path $Path '.git/HEAD')
if ($headContent -like "ref: refs/heads/*") {
$branchName = $headContent.Substring(16)
} else {
$branchName = "HEAD detached at $($headContent.Substring(0, 7))"
}
Write-Host " [$branchName]" -NoNewline -ForegroundColor DarkGray
}
return