From 0deff4f99aaf2e6389ab441eec04c68a9a27681d Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Wed, 1 Jun 2011 21:21:04 +0000 Subject: Valentin Haenel: 29431: Hook example for signaling untracked files in git repositories --- Misc/vcs_info-examples | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Misc/vcs_info-examples') diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index bc10a2179..860297c9e 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 -- cgit v1.2.3 From 8ce9c1cbe7c7d1abd0f8b4ddc879b606ce9505a8 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Wed, 19 Oct 2011 18:14:08 +0000 Subject: Suraj N. Kurapati: vcs_info-examples: Mention different ways to handle remote branch names in `vi-git-remotebranch()'. --- ChangeLog | 8 +++++++- Misc/vcs_info-examples | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'Misc/vcs_info-examples') diff --git a/ChangeLog b/ChangeLog index 1fc8de46c..18521a39b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-10-19 Frank Terbeck + + * Suraj N. Kurapati: 29828: Misc/vcs_info-examples: Mention + different ways to handle remote branch names in + `vi-git-remotebranch()'. + 2011-10-17 Peter Stephenson * unposted: NEWS, README, Config/version.mk, Etc/.distfiles, @@ -15470,5 +15476,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5478 $ +* $Revision: 1.5479 $ ***************************************************** diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index 860297c9e..ba3b2c367 100644 --- a/Misc/vcs_info-examples +++ b/Misc/vcs_info-examples @@ -205,7 +205,11 @@ function +vi-git-remotebranch() { remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \ --symbolic-full-name 2>/dev/null)/refs\/remotes\/} + # The first test will show a tracking branch whenever there is one. The + # second test, however, will only show the remote branch's name if it + # differs from the local one. if [[ -n ${remote} ]] ; then + #if [[ -n ${remote} && ${remote#*/} != ${hook_com[branch]} ]] ; then hook_com[branch]="${hook_com[branch]} [${remote}]" fi } -- cgit v1.2.3