Re: Bug? git worktree fails with master on bare repo
- From
Kevin Daudt <me@ikke.info>
- Date
- Oct 9, 2016, 06:50 UTC
- Message-ID
- <20161009065046.GD25613@ikke.info>
- In-Reply-To
- <CAOi_75+2SG2WYHBMQhfGj96eKsZ66niJzOevVGM5eJv-qqrVNg@mail.gmail.com>
On Sat, Oct 08, 2016 at 07:30:36PM -0500, Michael Tutty wrote:
Show 17 quoted lines
> Hey all, > I'm working on some server-side software to do a merge. By using git > worktree it's possible to check out a given branch for a bare repo and > merge another branch into it. It's very fast, even with large > repositories. > > The only exception seems to be merging to master. When I do git > worktree add /tmp/path/to/worktree master I get an error: > > [fatal: 'master' is already checked out at '/path/to/bare/repo'] > > But this is clearly not true, git worktree list gives: > > [/path/to/bare/repo (bare)] > > ...and of course, there is no work tree at that path, just the bare > repo files you'd expect.
A bare repo still has a HEAD, which by default points to refs/heads/master. That's what's it complaining about.
So the question is, should there be an exception for the branch 'checked out' on a bare reposity.