zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: vcs_info-examples: untracked hook for git
@ 2011-06-01 20:58 Frank Terbeck
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Terbeck @ 2011-06-01 20:58 UTC (permalink / raw)
  To: zsh workers

From: 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.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* PATCH: vcs_info-examples: untracked hook for git
@ 2011-05-01 11:54 Valentin Haenel
  0 siblings, 0 replies; 2+ messages in thread
From: Valentin Haenel @ 2011-05-01 11:54 UTC (permalink / raw)
  To: zsh-workers; +Cc: Valentin Haenel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-01 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 20:58 PATCH: vcs_info-examples: untracked hook for git Frank Terbeck
  -- strict thread matches above, loose matches on Subject: below --
2011-05-01 11:54 Valentin Haenel

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).