From 249b7170000d9c7af019ac3f7837edc2e7a2d32c Mon Sep 17 00:00:00 2001 From: Arialdo Martini Date: Wed, 4 Sep 2013 22:36:13 +0200 Subject: [PATCH] a star is displayed when stash list is not empty --- prompt.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prompt.sh b/prompt.sh index 289e27d..8263603 100644 --- a/prompt.sh +++ b/prompt.sh @@ -31,6 +31,8 @@ function build_prompt { if [[ -z "${rebase_tracking_branch_symbol}" ]]; then rebase_tracking_branch_symbol="↶"; fi if [[ -z "${merge_tracking_branch_symbol}" ]]; then merge_tracking_branch_symbol="ᄉ"; fi if [[ -z "${should_push_symbol}" ]]; then should_push_symbol="↑"; fi + if [[ -z "${has_stashes_symbol}" ]]; then has_stashes_symbol="★"; fi + # flags if [[ -z "${display_has_upstream}" ]]; then display_has_upstream=false; fi @@ -110,12 +112,16 @@ function build_prompt { fi will_rebase=$(git config --get branch.${current_branch}.rebase 2>/dev/null) + + number_of_stashes=$(git stash list | wc -l) + if [[ ${number_of_stashes} -gt 0 ]]; then has_stashes=true; else has_stashes=false; fi fi if [[ ${is_a_git_repo} == true ]] then enrich ${is_a_git_repo} "${is_a_git_repo_symbol}" + enrich ${has_stashes} "${has_stashes_symbol}" "${yellow}" enrich ${has_untracked_files} "${has_untracked_files_symbol}" enrich ${has_adds} "${has_adds_symbol}" @@ -192,6 +198,5 @@ function build_prompt { } - PROMPT_COMMAND=build_prompt