change default for GIT_PROMPT_SHOW_UNTRACKED_FILES to `normal`

The old default of `all` counts all untracked files - including files
listed in .gitignore, which basically makes that information worthless.

`normal` is the default if --show-untracked is not given, and will
list/count the same files as a `git status` will list.
master
Christian Boltz 8 years ago
parent 5356702cf5
commit 45a654b51e
No known key found for this signature in database
GPG Key ID: C6A682EA63C82F1C
  1. 5
      README.md
  2. 2
      gitprompt.sh
  3. 2
      gitstatus.sh

@ -151,7 +151,7 @@ cp gitprompt.fish ~/.config/fish/functions/fish_prompt.fish
# GIT_PROMPT_IGNORE_SUBMODULES=1 # uncomment to avoid searching for changed files in submodules # GIT_PROMPT_IGNORE_SUBMODULES=1 # uncomment to avoid searching for changed files in submodules
# 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=normal # 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_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files
@ -169,7 +169,8 @@ cp gitprompt.fish ~/.config/fish/functions/fish_prompt.fish
You can set the `GIT_PROMPT_SHOW_UNTRACKED_FILES` variable to `no` or `normal` to speed things up if you have lots of You can set the `GIT_PROMPT_SHOW_UNTRACKED_FILES` variable to `no` or `normal` to speed things up if you have lots of
untracked files in your repository. This can be the case for build systems that put their build artifacts in untracked files in your repository. This can be the case for build systems that put their build artifacts in
the subdirectory structure of the git repository. the subdirectory structure of the git repository. Setting it to `all` will count all untracked files, including files
listed in .gitignore.
- `cd` to a git repository and test it! - `cd` to a git repository and test it!

@ -488,7 +488,7 @@ function updatePrompt() {
export __GIT_PROMPT_IGNORE_SUBMODULES=${GIT_PROMPT_IGNORE_SUBMODULES} export __GIT_PROMPT_IGNORE_SUBMODULES=${GIT_PROMPT_IGNORE_SUBMODULES}
if [ -z "${GIT_PROMPT_SHOW_UNTRACKED_FILES}" ]; then if [ -z "${GIT_PROMPT_SHOW_UNTRACKED_FILES}" ]; then
export __GIT_PROMPT_SHOW_UNTRACKED_FILES=all export __GIT_PROMPT_SHOW_UNTRACKED_FILES=normal
else else
export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES} export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES}
fi fi

@ -21,7 +21,7 @@ else
_ignore_submodules= _ignore_submodules=
fi fi
gitstatus=$( LC_ALL=C git status ${_ignore_submodules} --untracked-files=${__GIT_PROMPT_SHOW_UNTRACKED_FILES:-all} --porcelain --branch ) gitstatus=$( LC_ALL=C git status ${_ignore_submodules} --untracked-files=${__GIT_PROMPT_SHOW_UNTRACKED_FILES:-normal} --porcelain --branch )
# if the status is fatal, exit now # if the status is fatal, exit now
[[ "$?" -ne 0 ]] && exit 0 [[ "$?" -ne 0 ]] && exit 0

Loading…
Cancel
Save