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

Re: git rev-parse --git-dir does report yield relative path to git directory, per documentation

From
Junio C Hamano <gitster@pobox.com>
Date
May 17, 2012, 16:38 UTC
Message-ID
<xmqqfwayrcen.fsf@junio.mtv.corp.google.com>
In-Reply-To
<CAH3Anrrb243zdRJJEqDcWrHBVBDdYkGB=sTG7BbjTzsUHvWY-w@mail.gmail.com>
Jon Seymour <jon.seymour@gmail.com> writes:
Show 5 quoted lines
> Per this advice in git-rev-parse(1):
>
>      Show $GIT_DIR if defined. Otherwise show the path to the .git
> directory, relative to the current directory.
> ...
Unfortunate.  Here is what the commit that wrote the sentence says:
    commit 80d868b068b9e68a4aac91be578a8f097f45d8da
    Author: Jonathan Nieder <jrnieder@gmail.com>
    Date:   Fri Nov 26 22:32:31 2010 +0700
        git-rev-parse.txt: clarify --git-dir
        The current behavior is often to print an absolute path rather than
        a ../../etc string, but callers must be ready to accept a relative
        path, too. The most common output is ".git" (from the toplevel of
        an ordinary work tree).
        Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
        Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
        Signed-off-by: Junio C Hamano <gitster@pobox.com>

I am not sure what we were smoking. I am guessing that it wanted to say that the path is something you can feed to chdir(2) to go there, but it should have done so without promising more than what it does.

Previous: Jon SeymourNext: Jonathan Nieder
Message 2 of 7 in “git rev-parse --git-dir does report yield relative path to git directory, per documentation”
  1. Jon SeymourMay 17, 2012
  2. Junio C HamanoMay 17, 2012
  3. Jonathan NiederMay 17, 2012
  4. Documentation: git-rev-parse: clarify that --git-dir does not necessarily show relative pathsJon Seymour, May 18, 2012
  5. Jonathan NiederMay 18, 2012
  6. Junio C HamanoMay 18, 2012
  7. Nguyen Thai Ngoc DuyMay 18, 2012

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.