aboutsummaryrefslogtreecommitdiffhomepage
path: root/share
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-05-28 19:30:29 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-05-28 19:30:29 +0200
commit8e88b29eeb9aa7c42a00a4188c6c26a17d8ad9f5 (patch)
tree62a9e8bb3354f24081c7449cab498cb25d24be22 /share
parentaaaea44714a3fbd1b75d21953ab837be18fc8d4f (diff)
Git prompt: Shorten the sha ourselves
Possibly fixes #3083.
Diffstat (limited to 'share')
-rw-r--r--share/functions/__fish_git_prompt.fish7
1 files changed, 4 insertions, 3 deletions
diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish
index 9a5be687..4073434b 100644
--- a/share/functions/__fish_git_prompt.fish
+++ b/share/functions/__fish_git_prompt.fish
@@ -592,9 +592,10 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
command git describe --tags --exact-match HEAD
end ^/dev/null; set os $status)
if test $os -ne 0
- set -q sha; and set -l short_sha (command git rev-parse --short $sha)
- if test -n "$short_sha"
- set branch $short_sha...
+ # Shorten the sha ourselves to 8 characters - this should be good for most repositories,
+ # and even for large ones it should be good for most commits
+ if set -q sha
+ set branch (string match -r '^.{8}' -- $sha)...
else
set branch unknown
end