aboutsummaryrefslogtreecommitdiff
path: root/zsh
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 /zsh
parent4b4f664e60b079922e58a54a8fa0c29c45cc6f63 (diff)
downloaddotfiles-5d61bb6546d4c4045f302c0c2daf7594820e6507.tar.gz
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 'zsh')
-rw-r--r--zsh/zshrc.d/prompt.zsh3
1 files changed, 2 insertions, 1 deletions
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index d646c05f..858ec2ea 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -70,7 +70,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