zsh-workers
 help / color / mirror / code / Atom feed
From: Valentin Haenel <valentin.haenel@gmx.de>
To: zsh-workers@zsh.org
Cc: Valentin Haenel <valentin.haenel@gmx.de>
Subject: PATCH: vcs_info-examples: untracked hook for git
Date: Sun,  1 May 2011 13:54:46 +0200	[thread overview]
Message-ID: <1304250886-20197-1-git-send-email-valentin.haenel@gmx.de> (raw)

Signed-off-by: Valentin Haenel <valentin.haenel@gmx.de>
---
 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


             reply	other threads:[~2011-05-01 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01 11:54 Valentin Haenel [this message]
2011-06-01 20:58 Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304250886-20197-1-git-send-email-valentin.haenel@gmx.de \
    --to=valentin.haenel@gmx.de \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).