From 1d97762b7a0b26a6a51d3d2e9e4adfcf5fb835aa Mon Sep 17 00:00:00 2001 From: Max Shishkin Date: Sat, 9 Aug 2014 17:41:30 +0200 Subject: [PATCH] Close GH-80: Include untracked files in dirtiness check. Fixes #1, Fixes #79 --- pure.zsh | 5 +++-- readme.md | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pure.zsh b/pure.zsh index 5b92ee5c..ac18964c 100644 --- a/pure.zsh +++ b/pure.zsh @@ -36,9 +36,10 @@ prompt_pure_git_dirty() { # check if we're in a git repo command git rev-parse --is-inside-work-tree &>/dev/null || return # check if it's dirty - command git diff --quiet --ignore-submodules HEAD &>/dev/null + [[ "$PURE_GIT_UNTRACKED_DIRTY" == 0 ]] && local umode="-uno" || local umode="-unormal" + command test -n "$(git status --porcelain --ignore-submodules ${umode})" - (($? == 1)) && echo '*' + (($? == 0)) && echo '*' } # displays the exec time of the last command if set threshold was exceeded diff --git a/readme.md b/readme.md index 6810d497..741a693b 100644 --- a/readme.md +++ b/readme.md @@ -84,6 +84,10 @@ The max execution time of a process before its run time is shown when it exits. Set `PURE_GIT_PULL=0` to prevent Pure from checking whether the current Git remote has been updated. +### `PURE_GIT_UNTRACKED_DIRTY` + +Set `PURE_GIT_UNTRACKED_DIRTY=0` to not include untracked files in dirtiness check. + ## Example ```sh