From 4c30ebdfeacc91731102ac10c6a3a7b5069b18c2 Mon Sep 17 00:00:00 2001 From: Raul Benencia Date: Mon, 23 Jan 2023 13:36:15 -0800 Subject: bash: fix prompt for non-git cases --- .bashrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bashrc b/.bashrc index f34c245..28e96c0 100644 --- a/.bashrc +++ b/.bashrc @@ -97,10 +97,10 @@ prompt_command_notitle () { local fullbranch="$(cat .git/HEAD 2>/dev/null)" if [ "$fullbranch" = "" ]; then - local fullbranch="ref: $(git symbolic-ref HEAD 2>/dev/null)" + local fullbranch="$(git symbolic-ref HEAD 2>/dev/null)" fi - local branch="${fullbranch#ref: refs/heads/}" - vcsinfo="${branch:+#$branch}" + local branch="${fullbranch##ref: }" + vcsinfo="${branch:+#${branch##refs/heads/}}" } prompt_command () { -- cgit v1.2.3