diff options
author | Raul Benencia <rul@kalgan.cc> | 2023-01-23 13:36:15 -0800 |
---|---|---|
committer | Raul Benencia <rul@kalgan.cc> | 2023-01-23 13:36:15 -0800 |
commit | 4c30ebdfeacc91731102ac10c6a3a7b5069b18c2 (patch) | |
tree | 257faa7aa5689bf6f525a1e0295cf5b5fe923881 | |
parent | 0306ea1c9a813344bf6b6dca52f1ac50422f4e3b (diff) |
bash: fix prompt for non-git cases
-rw-r--r-- | .bashrc | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 () { |