Don't continue prompt if there's no commits.
This commit is contained in:
parent
f0dcdf24f6
commit
b639d4db3c
1 changed files with 5 additions and 1 deletions
6
.bashrc
6
.bashrc
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue