aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/prompt.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-07 16:10:30 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-07 16:12:51 +1200
commit5d61bb6546d4c4045f302c0c2daf7594820e6507 (patch)
treef204587af26451ee437ca8655e8a383a4d463834 /bash/bashrc.d/prompt.bash
parentRemove fixed issue of `kill` completion (diff)
downloaddotfiles-5d61bb6546d4c4045f302c0c2daf7594820e6507.tar.gz
dotfiles-5d61bb6546d4c4045f302c0c2daf7594820e6507.zip
Restore old code for describing Git prompt commit
I'm really confused. I could have sworn this was working correctly (i.e. the --always option spat out a short reference to the commit as a fallback), but I must have been wrong. Maybe I hadn't installed the appropriate file when I was testing it. At first I thought this was a bug introduced in Git 2.10, but the short-circuit disregarding --always if --exact-match or --candidates=0 is set seems to have been in the `describe` builtin for ages. I must have just tested poorly; I can't see any other explanation in the source. No matter; this isn't much slower.
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r--bash/bashrc.d/prompt.bash3
1 files changed, 2 insertions, 1 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 3b99cc12..39ee175b 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -105,7 +105,8 @@ prompt() {
local name
name=$( {
git symbolic-ref --quiet HEAD ||
- git describe --all --always --exact-match HEAD
+ git describe --tags --exact-match HEAD ||
+ git rev-parse --short HEAD
} 2>/dev/null) || return
name=${name##*/}
[[ -n $name ]] || return