# Re: bug: setting GIT_DIR to $(git rev-parse --git-dir) changes behavior

2 messages from 2021-02-26 to 2021-02-27. Participants: Martin Nicolay, Junio C Hamano.
Thread: https://gitlist.dev/t/55218

## Martin Nicolay, 2021-02-26 07:54

Subject: Re: bug: setting GIT_DIR to $(git rev-parse --git-dir) changes behavior
Message-ID: <alpine.LSU.2.20.2102260846280.20742@cpza.bfz-tzou.qr>
URL: https://gitlist.dev/e/alpine.LSU.2.20.2102260846280.20742%40cpza.bfz-tzou.qr

```
On Thursday 2021-02-25 19:29, Junio C Hamano wrote:
> The root of the working tree is at /tmp/t/, the repository at
> /tmp/t/.git/, and you are in the foo/ subdirectory.  When you ask
> "where is the top level of the working tree in this state, because
> you do not have GIT_DIR or GIT_WORK_TREE environment variables, you
> are asking Git to "discover" both the .git/ directory and the top of
> the working tree, by starting at the current directory,
> i.e. /tmp/t/foo, which is where you are.

*facepalm* The part about GIT_DIR setting the work-tree in addition to 
the repository I hadn't read. How embarrasing.

I apoligize for my bad reading skills and wasting you time.

Thanks
Martin

```

## Junio C Hamano, 2021-02-27 21:06

Subject: Re: bug: setting GIT_DIR to $(git rev-parse --git-dir) changes behavior
Message-ID: <xmqq35xhte3n.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqq35xhte3n.fsf%40gitster.c.googlers.com
In-Reply-To: <alpine.LSU.2.20.2102260846280.20742@cpza.bfz-tzou.qr>

```
Martin Nicolay <m.nicolay@osm-ag.de> writes:

> On Thursday 2021-02-25 19:29, Junio C Hamano wrote:
>> The root of the working tree is at /tmp/t/, the repository at
>> /tmp/t/.git/, and you are in the foo/ subdirectory.  When you ask
>> "where is the top level of the working tree in this state, because
>> you do not have GIT_DIR or GIT_WORK_TREE environment variables, you
>> are asking Git to "discover" both the .git/ directory and the top of
>> the working tree, by starting at the current directory,
>> i.e. /tmp/t/foo, which is where you are.
>
> *facepalm* The part about GIT_DIR setting the work-tree in addition to
>  the repository I hadn't read. How embarrasing.
>
> I apoligize for my bad reading skills and wasting you time.

We would love to hear observations on which part of the
documentation was misleading and suggestions on how to make it
harder to misinterpret it.

No need to apologize, and thanks for reporting.

```
