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

Re: Git 1.8.4.2: 'git-rev-parse --is-inside-git-dir' wrong output!

From
Øystein Walle <oystwa@gmail.com>
Date
Nov 2, 2013, 10:24 UTC
Message-ID
<loom.20131102T110932-618@post.gmane.org>
In-Reply-To
<CACbqpSvU4qxc0WtquP6Eq8bZGjLxTrVhtT2Nqw90wb23ESkfcw@mail.gmail.com>
Ville Walveranta <walveranta <at> gmail.com> writes:
Show 17 quoted lines
> 
> "git-rev-parse --is-inside-git-dir" outputs "fatal: Not a git
> repository (or any of the parent directories): .git", instead of
> "false" when outside of a git directory.  "--is-inside-work-tree"
> behaves the same way. Both commands work correctly (i.e. output
> "true") when inside a git directory, or inside a work tree,
> respectively.
> 
> To test, I installed git 1.8.4.2 initially from
> https://launchpad.net/~git-core/+archive/ppa for Ubuntu 12.04.3, and
> then also compiled it from source, but both seem to behave the same
> way. The problem is not yet present in version 1.7.9.5.
> 
> Thanks,
> 
> Ville Walveranta
>
Hi,

I thought I'd try to bisect this but I ended up discovering that I get the exact same behaviour with both 1.7.9.5 and 1.8.4.2. 1.7.9.5 will also output 'fatal: ...' like 1.8.4.2 does.

Both version will however behave as expected if you provide --git-dir and --work-tree:

    $ pwd
    /home/osse
    $ git --version
    git version 1.8.4.2
    $ git --git-dir=/home/osse/git/.git \
          --work-tree=/home/osse/git    \
        rev-parse  --is-inside-work-tree
    false
Ditto for --is-inside-git-dir.

Incidentally I discovered that the new -C option does *not* behave this way:

$ git --version git version 1.8.5.rc0.23.gaa27064 $ git -C /home/osse/git rev-parse --is-inside-work-tree true

But given that the purpose of the -C option is to make Git behave as if you were in that directory this is perhaps expected behaviour.

Regards, Øsse

Previous: Ville WalverantaNext: John Keeping
Message 2 of 9 in “Git 1.8.4.2: 'git-rev-parse --is-inside-git-dir' wrong output!”
  1. Ville WalverantaNov 1, 2013
  2. Øystein WalleNov 2, 2013
  3. John KeepingNov 2, 2013
  4. Philip OakleyNov 2, 2013
  5. John KeepingNov 2, 2013
  6. Philip OakleyNov 2, 2013
  7. Ville WalverantaNov 2, 2013
  8. John KeepingNov 2, 2013
  9. Ville WalverantaNov 2, 2013

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.