diff options
author | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-05-17 10:49:24 +0200 |
---|---|---|
committer | Hugues Hiegel <hugues.hiegel@qosmos.com> | 2013-05-17 10:49:24 +0200 |
commit | e0cb375ce1ce82223952e1cf00400d2cd9dc7b36 (patch) | |
tree | 2ebc3bd7b165f53aaab7cc1c24083f8e723706c6 | |
parent | 549d5eaf130f608e21688ef21487eb7ca8f2e564 (diff) |
[Git] Improves speed for NFS folders..
-rw-r--r-- | 01_Internal.zsh | 16 | ||||
-rw-r--r-- | 12_Prompts.zsh | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/01_Internal.zsh b/01_Internal.zsh index 0769318..5fc6f4e 100644 --- a/01_Internal.zsh +++ b/01_Internal.zsh @@ -157,8 +157,6 @@ __get_git_branch () # Get git branch only from git managed folders (not ignored subfolders..) [ "$( ( git ls-files ; git ls-tree HEAD . ) 2>&- | head -n1)" = "" -a \( ! -d .git -o "$(git rev-parse --git-dir 2>&-)" != ".git" \) -a "$(git rev-parse --is-inside-git-dir 2>&-)" != "true" ] && return - GIT_DIR=$(git rev-parse --git-dir) - # Get current working GIT branch my_git_branch="$(git branch 2>&- | grep -E '^\* ' | cut -c3-)" @@ -278,7 +276,7 @@ __get_guilt_series () # a call to `__get_git_branch` __get_git_status () { - local my_git_status cached changed managment_folder + local my_git_status cached changed managment_folder _status if [ "$(git config --get zsh.check-status)" = "false" ] then @@ -287,7 +285,7 @@ __get_git_status () my_git_status=$_gcl_colors[uptodate]; - __debug -n " where to..." + __debug -n " repo..." if [ -f ".repo/manifests.git/config" ] then @@ -295,16 +293,20 @@ __get_git_status () return fi + __debug -n " inside / bare..." if [ "$(git rev-parse --is-inside-git-dir)" = "true" -o "$(git config --get core.bare)" = "true" ] ; then echo "$_gcl_colors[gitdir]" return fi - if [ "$(git status --porcelain . | cut -c1 | tr -d ' ?\n')" != "" ] ; then + _status=$(git status --porcelain .) + __debug -n " cached..." + if [ "$(echo $_status | cut -c1 | tr -d ' ?\n')" != "" ] ; then # Got any character but « » or «?» in first column : staged changes cached="yes" fi - if [ "$(git status --porcelain . | cut -c2 | tr -d ' ?\n')" != "" ] ; then + __debug -n " changed..." + if [ "$(echo $_status | cut -c2 | tr -d ' ?\n')" != "" ] ; then # Got any character but « » or «?» in second column : working tree changes changed="yes" fi @@ -312,8 +314,6 @@ __get_git_status () __debug __debug -n " cached/changed..." - GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) - if [ "$cached" != "" -a "$changed" != "" ] then my_git_status="$_gcl_colors[mixed]" diff --git a/12_Prompts.zsh b/12_Prompts.zsh index f5ec34f..3b94f03 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -204,6 +204,7 @@ __vcsbranch () # get git status # + export GIT_DIR=$(git rev-parse --git-dir 2>&-) GITBRANCH=$(__get_gcl_branch git) GITBRANCHSIZE=${#GITBRANCH} [ $GITBRANCHSIZE -gt 0 ] && GITBRANCHSIZE=$(($GITBRANCHSIZE)) |