zsh-workers
 help / color / mirror / code / Atom feed
* vcs_info: an variable for the .git directory in hooks
@ 2014-12-28 18:42 Quentin Pradet
  2015-01-02 11:29 ` Frank Terbeck
  0 siblings, 1 reply; 2+ messages in thread
From: Quentin Pradet @ 2014-12-28 18:42 UTC (permalink / raw)
  To: zsh-workers

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-02 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-28 18:42 vcs_info: an variable for the .git directory in hooks Quentin Pradet
2015-01-02 11:29 ` Frank Terbeck

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