From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8831 invoked by alias); 1 May 2011 12:07:57 -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: 29119 Received: (qmail 7687 invoked from network); 1 May 2011 12:07:46 -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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at kudu.in-berlin.de does not designate permitted sender hosts) From: Valentin Haenel To: zsh-workers@zsh.org Cc: Valentin Haenel Subject: PATCH: vcs_info-examples: untracked hook for git Date: Sun, 1 May 2011 13:54:46 +0200 Message-Id: <1304250886-20197-1-git-send-email-valentin.haenel@gmx.de> X-Mailer: git-send-email 1.7.2.3 Signed-off-by: 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.1