zsh-users
 help / color / mirror / code / Atom feed
* small nit about zsh vcs_info module
@ 2010-07-18 12:18 Michel Lespinasse
  0 siblings, 0 replies; only message in thread
From: Michel Lespinasse @ 2010-07-18 12:18 UTC (permalink / raw)
  To: ft; +Cc: zsh-users

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-07-18 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-18 12:18 small nit about zsh vcs_info module Michel Lespinasse

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