Merge branch 'status-branchonly' into status-branchonly-dax

This commit is contained in:
dgames 2021-05-30 07:56:01 -04:00
commit a41fad80d5
3 changed files with 26 additions and 1 deletions

1
vendor/clink.lua vendored
View File

@ -434,7 +434,6 @@ local function git_prompt_filter()
return false
end
end
end
-- No git present or not in git file

18
vendor/git-prompt.sh vendored
View File

@ -9,6 +9,21 @@ function getGitStatusSetting() {
fi
}
function getSimpleGitBranch() {
gitDir=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$gitDir" ]; then
return 0
fi
headContent=$(< "$gitDir/HEAD")
if [[ "$headContent" == "ref: refs/heads/"* ]]
then
echo " (${headContent:16})"
else
echo " (HEAD detached at ${headContent:0:7})"
fi
}
if test -f /etc/profile.d/git-sdk.sh
then
TITLEPREFIX=SDK-${MSYSTEM#MINGW}
@ -45,6 +60,9 @@ else
. "$COMPLETION_PATH/git-prompt.sh"
PS1="$PS1"'\[\033[36m\]' # change color to cyan
PS1="$PS1"'`__git_ps1`' # bash function
else
PS1="$PS1"'\[\033[30;1m\]' # change color to gray
PS1="$PS1"'`getSimpleGitBranch`'
fi
fi
fi

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