On Thu, Aug 27, 2015 at 3:03 PM, John Szakmeister <j...@szakmeister.net> wrote:
> My apologies if this has already been reported, but I ran into an
> interesting bug with worktrees.  In particular, I have an alias 'st'
> that maps to 'status -sb'.  When running this under a subdirectory of
> a worktree created with 'git worktree add', it fails complaining that
> the work tree has already been set.
>
> Here's a script to reproduce the problem:
>     git init test-repo
>     cd test-repo
>     git config --local alias.st 'status -sb'
>     mkdir subdir
>     echo file > subdir/file.txt
>     git add subdir/file.txt
>     git commit -m 'add file'
>     git branch foo
>     git worktree add ../new-worktree foo
>     cd ../new-worktree/subdir
>     echo "new line" >> file.txt
>     echo "this will work"
>     git status -sb
>     echo "this fails"
>     git st
>
> When I run it, I see this:
> [...]
> fatal: internal error: work tree has already been set
> Current worktree: /home/jszakmeister/tmp/test-case/new-worktree
> New worktree: /home/jszakmeister/tmp/test-case/new-worktree/subdir

I can reproduce with 2.5.0 but not 'master'. Bisection reveals that
this was fixed by d95138e (setup: set env $GIT_WORK_TREE when work
tree is set, like $GIT_DIR, 2015-06-26), and was reported previously
here [1].

[1]: 
http://git.661346.n2.nabble.com/Linked-workdirs-break-typo-correction-td7634347.html
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to