Skip to content

Commit 7ab9317

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents e29784d + 34eabc5 commit 7ab9317

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ Add to the `~/.bashrc`:
127127

128128
# GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
129129
# GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files
130+
131+
# GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files
130132

131133
# GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10
132134

gitprompt.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ function updatePrompt() {
470470
export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES}
471471
fi
472472

473+
if [ -z "${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}" ]; then
474+
export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=1
475+
else
476+
export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}
477+
fi
478+
473479
local GIT_INDEX_PRIVATE="$(createPrivateIndex)"
474480
#important to define GIT_INDEX_FILE as local: This way it only affects this function (and below) - even with the export afterwards
475481
local GIT_INDEX_FILE
@@ -513,7 +519,7 @@ function updatePrompt() {
513519
v="\$GIT_$1 $2"
514520
fi
515521
if eval "test $v" ; then
516-
if [[ $# -lt 2 || "$3" != '-' ]]; then
522+
if [[ $# -lt 2 || "$3" != '-' ]] && [[ "x$__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT" == "x1" || "x$1" == "xREMOTE" ]]; then
517523
__add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor"
518524
else
519525
__add_status "\$GIT_PROMPT_$1\$ResetColor"

0 commit comments

Comments
 (0)