git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] Implement poor-man's submodule support in pre-commit hook

From
Andreas Ericsson <ae@op5.se>
Date
Dec 20, 2006, 12:35 UTC
Message-ID
<45892E16.2040301@op5.se>
In-Reply-To
<emb8h2$io4$1@sea.gmane.org>
Jakub Narebski wrote:
Show 20 quoted lines
> Brian Gernhardt wrote:
> 
>> On Dec 20, 2006, at 5:08 AM, Andy Parkins wrote:
>>
>>> Hello,
>>>
>>> Help...
>>>
>>>> +if [ -f .gitmodules ]; then
>>> This doesn't work because git-commit is not necessarily in the root  
>>> of the
>>> working tree.  How do I safely get that root?  While ${GIT_DIR}/..  
>>> would work
>>> it is not guaranteed.
>> The way to do that seems to be "git rev-parse --git-dir".  I'm not  
>> sure why it's not just "git --git-dir" or similar (probably just  
>> historical reasons), but there you go.
> 
> Because it is "git --git-dir=<PATH>" to set it (probably).
> Although it is not insurmountable difficulity...

AFAIR, the discussions long ago went along the lines of "if no argument is passed to any of the --*-dir options, print out the current value". If "git --git-dir" doesn't print the directory name of the .git directory inside the repo you're currently in, I'd consider it a bug.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Previous: Jakub NarebskiNext: Brian Gernhardt
Message 5 of 11 in “Implement poor-man's submodule support in pre-commit hook”
  1. Implement poor-man's submodule support in pre-commit hookAndy Parkins, Dec 20, 2006
  2. Andy ParkinsDec 20, 2006
  3. Brian GernhardtDec 20, 2006
  4. Jakub NarebskiDec 20, 2006
  5. Andreas EricssonDec 20, 2006
  6. [BUG] git --git-dir dies with bus errorBrian Gernhardt, Dec 20, 2006
  7. Jakub NarebskiDec 20, 2006
  8. Andy ParkinsDec 20, 2006
  9. Junio C HamanoDec 20, 2006
  10. Andy ParkinsDec 21, 2006
  11. Junio C HamanoDec 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.