From 56bc1b3f47e4dbe72ef13a3227dd90682c6dbea8 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Mon, 8 Feb 2016 17:14:28 +0100 Subject: [PATCH 1/3] dirty check even in subdirs Signed-off-by: Sebastien Varrette --- functions/vcs.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index b23b8330..cf980d23 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -7,8 +7,12 @@ ################################################################ function +vi-git-untracked() { + local FLAGS + FLAGS=('--porcelain') + # TODO: check git >= 1.7.2 + FLAGS+='--ignore-submodules=dirty' if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \ - -n $(git ls-files --others --exclude-standard | sed q) ]]; then + -n $(git status ${FLAGS} 2> /dev/null | tail -n1) ]]; then hook_com[unstaged]+=" %F{$POWERLEVEL9K_VCS_FOREGROUND}$(print_icon 'VCS_UNTRACKED_ICON')%f" VCS_WORKDIR_HALF_DIRTY=true else From 0fd9d277f93bf45acf6ab0dc280666458c58bd74 Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Tue, 9 Feb 2016 14:09:33 +0100 Subject: [PATCH 2/3] correct half-dirty detection -- restrict to untracked files Signed-off-by: Sebastien Varrette --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index cf980d23..c2c94022 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -12,7 +12,7 @@ function +vi-git-untracked() { # TODO: check git >= 1.7.2 FLAGS+='--ignore-submodules=dirty' if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \ - -n $(git status ${FLAGS} 2> /dev/null | tail -n1) ]]; then + -n $(git status ${FLAGS} | grep '^??' 2> /dev/null | tail -n1) ]]; then hook_com[unstaged]+=" %F{$POWERLEVEL9K_VCS_FOREGROUND}$(print_icon 'VCS_UNTRACKED_ICON')%f" VCS_WORKDIR_HALF_DIRTY=true else From 52982e3f63133b528714e65e35b4a44d438ef1ce Mon Sep 17 00:00:00 2001 From: Sebastien Varrette Date: Tue, 9 Feb 2016 14:22:47 +0100 Subject: [PATCH 3/3] mention to git_compare_version Signed-off-by: Sebastien Varrette --- functions/vcs.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/vcs.zsh b/functions/vcs.zsh index c2c94022..3eec5dfd 100644 --- a/functions/vcs.zsh +++ b/functions/vcs.zsh @@ -9,7 +9,7 @@ function +vi-git-untracked() { local FLAGS FLAGS=('--porcelain') - # TODO: check git >= 1.7.2 + # TODO: check git >= 1.7.2 - see function git_compare_version() FLAGS+='--ignore-submodules=dirty' if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \ -n $(git status ${FLAGS} | grep '^??' 2> /dev/null | tail -n1) ]]; then