Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ogr3 committed Aug 18, 2016
2 parents e29784d + 34eabc5 commit 7ab9317
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ Add to the `~/.bashrc`:

# 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_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

Expand Down
8 changes: 7 additions & 1 deletion gitprompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -513,7 +519,7 @@ function updatePrompt() {
v="\$GIT_$1 $2"
fi
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"
else
__add_status "\$GIT_PROMPT_$1\$ResetColor"
Expand Down

0 comments on commit 7ab9317

Please sign in to comment.