Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: vcs_info: an variable for the .git directory in hooks
- X-seq: zsh-workers 34076
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: Quentin Pradet <quentin@xxxxxxxxx>
- Subject: Re: vcs_info: an variable for the .git directory in hooks
- Date: Fri, 02 Jan 2015 12:29:31 +0100
- Cc: zsh-workers <zsh-workers@xxxxxxx>
- In-reply-to: <54A04EFE.2090303@pradet.me> (Quentin Pradet's message of "Sun, 28 Dec 2014 19:42:06 +0100")
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <54A04EFE.2090303@pradet.me>
Quentin Pradet wrote:
> 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?
I think that the most straight-forward solution would be to just call
the ‘rev-parse’ command when you need it in a hook. I'd like to not add
another command invocation if it can be avoided, unless there's a
legitimate use-case outside of a hook.
Regards, Frank
Messages sorted by:
Reverse Date,
Date,
Thread,
Author