# rev-parse --is-bare-repository incorrect when work tree is set

2 messages from 2019-06-15 to 2019-06-15. Participants: Sam Bazley, SZEDER Gábor.
Thread: https://gitlist.dev/t/51320

## Sam Bazley, 2019-06-15 01:59

Subject: rev-parse --is-bare-repository incorrect when work tree is set
Message-ID: <8ac7a1d8-9185-b527-67f4-d5e25cb3eaf5@fastmail.com>
URL: https://gitlist.dev/e/8ac7a1d8-9185-b527-67f4-d5e25cb3eaf5%40fastmail.com

```
rev-parse --is-bare-repository incorrectly outputs "false" when testing
a bare repository with the work tree set.

To reproduce:

$ git init --bare testbare
$ git --git-dir=testbare rev-parse --is-bare-repository
true
$ git --git-dir=testbare --work-tree=something rev-parse \
--is-bare-repository
false
$ GIT_WORK_TREE=something git --git-dir=testbare rev-parse \
--is-bare-repository
false

```

## SZEDER Gábor, 2019-06-15 08:56

Subject: Re: rev-parse --is-bare-repository incorrect when work tree is set
Message-ID: <20190615085602.GH31952@szeder.dev>
URL: https://gitlist.dev/e/20190615085602.GH31952%40szeder.dev
In-Reply-To: <8ac7a1d8-9185-b527-67f4-d5e25cb3eaf5@fastmail.com>

```
On Sat, Jun 15, 2019 at 02:59:50AM +0100, Sam Bazley wrote:
> rev-parse --is-bare-repository incorrectly outputs "false" when testing
> a bare repository with the work tree set.
> 
> To reproduce:
> 
> $ git init --bare testbare
> $ git --git-dir=testbare rev-parse --is-bare-repository
> true
> $ git --git-dir=testbare --work-tree=something rev-parse \
> --is-bare-repository
> false
> $ GIT_WORK_TREE=something git --git-dir=testbare rev-parse \
> --is-bare-repository
> false

A bare repository is a repository that doesn't have a worktree, and in
the last two cases you explicitly told git that it should treat
something as a worktree, so it just acted accordingly.


```
