From: Quentin Pradet <quentin@pradet.me>
To: zsh-workers <zsh-workers@zsh.org>
Subject: vcs_info: an variable for the .git directory in hooks
Date: Sun, 28 Dec 2014 19:42:06 +0100 [thread overview]
Message-ID: <54A04EFE.2090303@pradet.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
vcs_info exposes the `base` variable in `hook_com` to get to the base
directory of a repository. For git, the only use I know is to get to the
.git directory in order to retrieve something there. For example, this
hook <http://eseth.org/2010/git-in-zsh.html#show-stashed-changes> looks
up $base/.git/refs/stash to see if there are any stashed changes.
However, that's a bad idea, because it won't work in eg. submodules,
where the real .git folder is in .git/modules/path/to/module/. The
correct solution is to use `git rev-parse --git-dir` which will do the
right thing. Would that make sense to expose the result of that command
in a `miscN` variable?
Quentin
next reply other threads:[~2014-12-28 19:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-28 18:42 Quentin Pradet [this message]
2015-01-02 11:29 ` Frank Terbeck
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=54A04EFE.2090303@pradet.me \
--to=quentin@pradet.me \
--cc=zsh-workers@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).