From: Michel Lespinasse <walken@google.com>
To: ft@bewatermyfriend.org
Cc: zsh-users@zsh.org
Subject: small nit about zsh vcs_info module
Date: Sun, 18 Jul 2010 05:18:46 -0700 [thread overview]
Message-ID: <20100718121846.GA15276@google.com> (raw)
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.
reply other threads:[~2010-07-18 12:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20100718121846.GA15276@google.com \
--to=walken@google.com \
--cc=ft@bewatermyfriend.org \
--cc=zsh-users@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).