aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--bash/bashrc.d/prompt.bash3
-rw-r--r--pdksh/pdkshrc.d/prompt.pdksh3
-rw-r--r--zsh/zshrc.d/prompt.zsh3
3 files changed, 6 insertions, 3 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
diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/pdksh/pdkshrc.d/prompt.pdksh
index 920e21ae..7e6dd8fe 100644
--- a/pdksh/pdkshrc.d/prompt.pdksh
+++ b/pdksh/pdkshrc.d/prompt.pdksh
@@ -101,7 +101,8 @@ prompt() {
typeset 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
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