Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
vcs_info: an variable for the .git directory in hooks
- X-seq: zsh-workers 34069
- From: Quentin Pradet <quentin@xxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxx>
- Subject: vcs_info: an variable for the .git directory in hooks
- Date: Sun, 28 Dec 2014 19:42:06 +0100
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alwaysdata.net; s=pradet; h=Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=DyZkBkqsMWf7Ncdbek/3rbKB+wuz3v89bBR11I/Lth4=; b=U8Ngm4E/JE1HD77g/UkiQyWza5mram0hi1/xHSk1Y5I0GlhCC+iRqn2HnsOOk6sxFvWixr3f8PKkFpbrOf0afxAsLinIe82hI4NJmVjTMEvQj5BRUunNoOs9mi0cTjNOBffallQ38BjAhHWasSKogrr4PpVaFAzc29kPRKiw/0E=;
- 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
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author