diff --git a/gitprompt.sh b/gitprompt.sh index 492cd93..8d6045f 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -470,6 +470,12 @@ function updatePrompt() { export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES} fi + if [ -z "${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}" ]; then + export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=1 + else + export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT} + fi + local GIT_INDEX_PRIVATE="$(createPrivateIndex)" #important to define GIT_INDEX_FILE as local: This way it only affects this function (and below) - even with the export afterwards local GIT_INDEX_FILE @@ -513,7 +519,9 @@ function updatePrompt() { v="\$GIT_$1 $2" fi if eval "test $v" ; then - if [[ $# -lt 2 || "$3" != '-' ]]; then + if [[ $# -lt 2 || "$3" != '-' ]] && [[ "x$1" == "xREMOTE" ]]; then + __add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor" + elif [[ $# -lt 2 || "$3" != '-' ]] && [[ "${__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}" -eq "1" ]]; then __add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor" else __add_status "\$GIT_PROMPT_$1\$ResetColor"