diff --git a/.bashrc b/.bashrc index e516973..f74e387 100644 --- a/.bashrc +++ b/.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