Don't continue prompt if there's no commits.

This commit is contained in:
Darren 'Tadgy' Austin 2023-10-28 23:07:34 +01:00
commit b639d4db3c

View file

@ -51,7 +51,11 @@ __prompt_git_status() {
BRANCH="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
if [[ "$BRANCH" == "HEAD" ]]; then
GIT_PROMPT+="?NO COMMITS?"
unset BRANCH
# Output the prompt and escape early.
# shellcheck disable=SC2059
printf -- "$1" "$GIT_PROMPT"
return 0
else
GIT_PROMPT+="$BRANCH"
fi