From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9522 invoked by alias); 1 Jun 2011 21:02:21 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29431 Received: (qmail 7882 invoked from network); 1 Jun 2011 21:02:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: zsh workers Subject: PATCH: vcs_info-examples: untracked hook for git Date: Wed, 1 Jun 2011 22:58:56 +0200 Message-Id: <1306961936-23031-1-git-send-email-ft@bewatermyfriend.org> X-Mailer: git-send-email 1.7.5 X-Df-Sender: 430444 From: Valentin Haenel --- Misc/vcs_info-examples | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index bc10a21..860297c 100644 --- a/Misc/vcs_info-examples +++ b/Misc/vcs_info-examples @@ -155,6 +155,23 @@ function +vi-hg-shorthash() { ret=1 } +### Display the existence of files not yet known to VCS + +### git: Show marker (T) if there are untracked files in repository +# Make sure you have added staged to your 'formats': %c +zstyle ':vcs_info:git*+set-message:*' hooks git-untracked + ++vi-git-untracked(){ + if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \ + git status --porcelain | grep '??' &> /dev/null ; then + # This will show the marker if there are any untracked files in repo. + # If instead you want to show the marker only if there are untracked + # files in $PWD, use: + #[[ -n $(git ls-files --others --exclude-standard) ]] ; then + hook_com[staged]+='T' + fi +} + ### Compare local changes to remote changes -- 1.7.5