threads / discuss / 51320

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

Subject: rev-parse --is-bare-repository incorrect when work tree is set

## tl;dr

2 messages between Jun 15, 2019 and Jun 15, 2019.

replies: 1people: 2as markdown or json

Sam Bazley· Jun 15, 2019, 01:59 UTC · lore

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· Jun 15, 2019, 08:56 UTC · re: Sam Bazley · lore

Re: rev-parse --is-bare-repository incorrect when work tree is set

On Sat, Jun 15, 2019 at 02:59:50AM +0100, Sam Bazley wrote:
Show 14 quoted lines
> 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.

← back to recent threads