a star is displayed when stash list is not empty

This commit is contained in:
Arialdo Martini 2013-09-04 22:36:13 +02:00
parent 87a75f7d77
commit 249b717000

View File

@ -31,6 +31,8 @@ function build_prompt {
if [[ -z "${rebase_tracking_branch_symbol}" ]]; then rebase_tracking_branch_symbol="↶"; fi 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 "${merge_tracking_branch_symbol}" ]]; then merge_tracking_branch_symbol="ᄉ"; fi
if [[ -z "${should_push_symbol}" ]]; then should_push_symbol="↑"; fi if [[ -z "${should_push_symbol}" ]]; then should_push_symbol="↑"; fi
if [[ -z "${has_stashes_symbol}" ]]; then has_stashes_symbol="★"; fi
# flags # flags
if [[ -z "${display_has_upstream}" ]]; then display_has_upstream=false; fi if [[ -z "${display_has_upstream}" ]]; then display_has_upstream=false; fi
@ -110,12 +112,16 @@ function build_prompt {
fi fi
will_rebase=$(git config --get branch.${current_branch}.rebase 2>/dev/null) 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 fi
if [[ ${is_a_git_repo} == true ]] if [[ ${is_a_git_repo} == true ]]
then then
enrich ${is_a_git_repo} "${is_a_git_repo_symbol}" 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_untracked_files} "${has_untracked_files_symbol}"
enrich ${has_adds} "${has_adds_symbol}" enrich ${has_adds} "${has_adds_symbol}"
@ -192,6 +198,5 @@ function build_prompt {
} }
PROMPT_COMMAND=build_prompt PROMPT_COMMAND=build_prompt