Fix branch detection.

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-10 16:25:34 +01:00
commit 66537fbcde

View file

@ -52,9 +52,9 @@ __prompt_git_status() {
fi
}
# Add the branch if there have been commits.
if [[ -e "${GIT_REPO_INFO[1]}/refs/heads/master" ]]; then
BRANCH="$(git describe --contains --all HEAD)"
# Add the branch or a no commits marker.
BRANCH="$(git describe --contains --all HEAD 2>/dev/null)"
if [[ -n "$BRANCH" ]]; then
GIT_PROMPT+="$BRANCH"
else
GIT_PROMPT+="!NO COMMITS!"