aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Benencia <rul@kalgan.cc>2023-01-23 13:36:15 -0800
committerRaul Benencia <rul@kalgan.cc>2023-01-23 13:36:15 -0800
commit4c30ebdfeacc91731102ac10c6a3a7b5069b18c2 (patch)
tree257faa7aa5689bf6f525a1e0295cf5b5fe923881
parent0306ea1c9a813344bf6b6dca52f1ac50422f4e3b (diff)
bash: fix prompt for non-git cases
-rw-r--r--.bashrc6
1 files 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 () {
nihil fit ex nihilo