From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13048 invoked by alias); 28 Dec 2014 19:11:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34069 Received: (qmail 12448 invoked from network); 28 Dec 2014 19:11:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 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=; Message-ID: <54A04EFE.2090303@pradet.me> Date: Sun, 28 Dec 2014 19:42:06 +0100 From: Quentin Pradet User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: zsh-workers Subject: vcs_info: an variable for the .git directory in hooks Content-Type: multipart/alternative; boundary="------------040108010804090808000101" X-alwaysdata-ID: 41589285 --------------040108010804090808000101 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 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 --------------040108010804090808000101--