From 5d61bb6546d4c4045f302c0c2daf7594820e6507 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 7 Sep 2016 16:10:30 +1200 Subject: 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. --- zsh/zshrc.d/prompt.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'zsh') 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 -- cgit v1.2.3