Merge pull request #281 from ogr3/fileCount

Possible to not print the number of changed files
master
Martin Gondermann 9 years ago committed by GitHub
commit 34eabc5da4
  1. 2
      README.md
  2. 8
      gitprompt.sh

@ -126,6 +126,8 @@ Add to the `~/.bashrc`:
# GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch # GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
# GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files # GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files
# GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files
# GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10 # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10

@ -470,6 +470,12 @@ function updatePrompt() {
export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES} export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES}
fi 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)" 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 #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 local GIT_INDEX_FILE
@ -513,7 +519,7 @@ function updatePrompt() {
v="\$GIT_$1 $2" v="\$GIT_$1 $2"
fi fi
if eval "test $v" ; then if eval "test $v" ; then
if [[ $# -lt 2 || "$3" != '-' ]]; then if [[ $# -lt 2 || "$3" != '-' ]] && [[ "x$__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT" == "x1" || "x$1" == "xREMOTE" ]]; then
__add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor" __add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor"
else else
__add_status "\$GIT_PROMPT_$1\$ResetColor" __add_status "\$GIT_PROMPT_$1\$ResetColor"

Loading…
Cancel
Save