summaryrefslogtreecommitdiff
path: root/functions
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2018-11-12 02:15:52 +0300
committerDominik Ritter <dritter03@googlemail.com>2018-11-12 02:15:52 +0300
commita6e60def4ba8b5f97e1ae4af8147a61b321d5dbf (patch)
treea40fc102a3bc6561a126592f7a68f4b93ccd6559 /functions
parent645b9746772a977c7ae03d5ed1d990e5e3ee9f3e (diff)
Fix stashes display
Changing directories while checking for untracked files broke the display of git stashes. The hook was not called any more. This is why we disabled checking for untracked files within a .git folder.
Diffstat (limited to 'functions')
-rwxr-xr-xfunctions/vcs.zsh28
1 files changed, 6 insertions, 22 deletions
diff --git a/functions/vcs.zsh b/functions/vcs.zsh
index 321424c6..4cd778a4 100755
--- a/functions/vcs.zsh
+++ b/functions/vcs.zsh
@@ -8,35 +8,19 @@
set_default POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY false
function +vi-git-untracked() {
- [[ -z "${vcs_comm[gitdir]}" ]] && return
-
- # If we are in a repos root folder, vcs_comm[gitdir] yields ".git".
- # Inside the .git dir itself (and not a subdir of it) the variable
- # yields ".". In any other case (either a subdirectory of .git or
- # the repo itself), the value of vcs_comm[gitdir] is the absolute
- # path to the .git directory.
- # Therefore we can step up a directory, if we are inside the .git
- # folder. And in any other case, use the parent directory of the
- # gitdir.
- local repoDir="."
- # Getting the parent dir of the current dir "." is still ".", so
- # is is safe to do this always.
- [[ "${vcs_comm[gitdir]}" != ".git" ]] && repoDir="${vcs_comm[gitdir]:h}"
- [[ "${vcs_comm[gitdir]}" == "." ]] && repoDir=".."
-
- if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "true" && "$(cd ${repoDir} && command git submodule foreach --quiet --recursive 'command git ls-files --others --exclude-standard')" != "" ]]; then
+ [[ -z "${vcs_comm[gitdir]}" || "${vcs_comm[gitdir]}" == "." ]] && return
+ # If we are in a .git folder, do not check for untracked files.
+ [[ "${PWD:A}" =~ "\.git/" ]] && return
+
+ if [[ "$POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY" == "true" && "$(command git submodule foreach --quiet --recursive 'command git ls-files --others --exclude-standard')" != "" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
VCS_WORKDIR_HALF_DIRTY=true
- elif [[ "$(cd ${repoDir} && command git ls-files --others --exclude-standard)" != "" ]]; then
+ elif [[ "$(command git ls-files --others --exclude-standard)" != "" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
VCS_WORKDIR_HALF_DIRTY=true
else
VCS_WORKDIR_HALF_DIRTY=false
fi
-
- # If we are in any other directory than the repo root, we want
- # to go back a directory.
- [[ "${vcs_comm[gitdir]}" != ".git" ]] && cd - >/dev/null
}
function +vi-git-aheadbehind() {