fewer forks, more speed

This commit is contained in:
Loic Nageleisen 2013-12-14 16:22:48 +01:00
parent 904ff11aa9
commit 5777fbff70

View file

@ -117,7 +117,7 @@ __git_ps1_vars() {
# find base dir (toplevel) # find base dir (toplevel)
[[ $bare -eq 1 ]] && toplevel="$g" [[ $bare -eq 1 ]] && toplevel="$g"
[[ $bare -eq 0 ]] && toplevel="$(dirname $g)" [[ $bare -eq 0 ]] && toplevel="${g%/*}"
# find relative path within toplevel # find relative path within toplevel
prefix="${PWD/#$toplevel/}" prefix="${PWD/#$toplevel/}"
@ -139,7 +139,7 @@ __git_ps1_vars() {
# working directory status # working directory status
if [[ $work -eq 1 ]]; then if [[ $work -eq 1 ]]; then
## dirtiness, if config allows it ## dirtiness, if config allows it
if [[ -n "${GIT_PS1_SHOWDIRTYSTATE-}" && "$(git config --bool bash.showDirtyState)" != "false" ]]; then if [[ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]]; then
# unstaged files # unstaged files
git diff --no-ext-diff --ignore-submodules --quiet --exit-code || unstaged=1 git diff --no-ext-diff --ignore-submodules --quiet --exit-code || unstaged=1