From 11e23a2c251974580698357e7dbd56a04108f793 Mon Sep 17 00:00:00 2001 From: Yehor Lvivski Date: Fri, 8 Nov 2013 01:16:02 +0200 Subject: [PATCH] super fast stash detection --- prompt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prompt.sh b/prompt.sh index 8b4d8d6..acad366 100644 --- a/prompt.sh +++ b/prompt.sh @@ -54,7 +54,7 @@ function build_prompt { PS1="" # Git info - current_commit_hash=$(git rev-parse --short HEAD 2> /dev/null) + current_commit_hash=$(git rev-parse HEAD 2> /dev/null) if [[ -n $current_commit_hash ]]; then is_a_git_repo=true; else is_a_git_repo=false; fi number_of_logs=$(git log --pretty=oneline -n1 2> /dev/null | wc -l) @@ -111,7 +111,7 @@ function build_prompt { will_rebase=$(git config --get branch.${current_branch}.rebase 2> /dev/null) - number_of_stashes=$(git stash list 2> /dev/null | wc -l) + number_of_stashes=$(cat .git/refs/stash 2> /dev/null | wc -l) if [[ $number_of_stashes -gt 0 ]]; then has_stashes=true; else has_stashes=false; fi else is_on_a_tag=false @@ -139,7 +139,7 @@ function build_prompt { if [[ $just_init == true ]]; then PS1="${PS1}${red}detached" else - PS1="${PS1}${on}(${current_commit_hash})" + PS1="${PS1}${on}(${current_commit_hash:0:7})" fi else if [[ $has_upstream == true ]]; then