Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

small nit about zsh vcs_info module



Hi,

I recently started using your vcs_info module & I love it :)

I wanted to report a small nit I have about it. Right after creating a
new git repository with 'git init', vcs_info reports that there are staged
files in it. This is because .git/HEAD points to refs/heads/master,
which does not exist anymore, so git diff-index return code is 128.

Following patch fixes the issue for me:

--- VCS_INFO_get_data_git.orig	2010-07-18 04:57:55.000000000 -0700
+++ VCS_INFO_get_data_git	2010-07-18 05:00:49.000000000 -0700
@@ -139,8 +139,8 @@
     # Default: off - these are potentially expensive on big repositories
     ${vcs_comm[cmd]} diff --no-ext-diff --ignore-submodules --quiet --exit-code ||
         gitunstaged=1
-    ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD ||
-        gitstaged=1
+    ${vcs_comm[cmd]} diff-index --cached --quiet --ignore-submodules HEAD 2>/dev/null
+    [[ $? -eq 1 ]] && gitstaged=1
 fi
 
 VCS_INFO_adjust


Hope this helps. Thanks for writing the vcs_info module !

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.



Messages sorted by: Reverse Date, Date, Thread, Author