{"thread":{"id":"40200","subject":"Bug with worktrees...","startedAt":"2015-08-27T19:03:57Z","lastAt":"2015-08-28T10:27:46Z","messageCount":3,"participants":["John Szakmeister","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"268804","messageId":"CAEBDL5UQSvS=t1dUKYqK6R=xHU6RU3bS72w-i02ey-Y_VB9KMQ@mail.gmail.com","threadId":"40200","inReplyTo":null,"subject":"Bug with worktrees...","fromName":"John Szakmeister","fromEmail":"john@szakmeister.net","sentAt":"2015-08-27T19:03:57Z","receivedAt":"2015-08-27T19:03:57Z","isPatch":false,"sender":{"key":"john@szakmeister.net","avatar":"https://avatars.githubusercontent.com/u/448087?v=4"},"body":"My apologies if this has already been reported, but I ran into an\ninteresting bug with worktrees.  In particular, I have an alias 'st'\nthat maps to 'status -sb'.  When running this under a subdirectory of\na worktree created with 'git worktree add', it fails complaining that\nthe work tree has already been set.\n\nHere's a script to reproduce the problem:\n    git init test-repo\n    cd test-repo\n    git config --local alias.st 'status -sb'\n    mkdir subdir\n    echo file > subdir/file.txt\n    git add subdir/file.txt\n    git commit -m 'add file'\n    git branch foo\n    git worktree add ../new-worktree foo\n    cd ../new-worktree/subdir\n    echo \"new line\" >> file.txt\n    echo \"this will work\"\n    git status -sb\n    echo \"this fails\"\n    git st\n\nWhen I run it, I see this:\n\nInitialized empty Git repository in\n/home/jszakmeister/tmp/test-case/test-repo/.git/\n[master (root-commit) 1ec5360] add file\n 1 file changed, 1 insertion(+)\n create mode 100644 subdir/file.txt\nEnter ../new-worktree (identifier new-worktree)\nSwitched to branch 'foo'\nthis will work\n## foo\nthis fails\nfatal: internal error: work tree has already been set\nCurrent worktree: /home/jszakmeister/tmp/test-case/new-worktree\nNew worktree: /home/jszakmeister/tmp/test-case/new-worktree/subdir\n\nHope this helps!\n\n-John\n"},{"id":"268821","messageId":"CAPig+cTkeOywRH1-_4Zi9jOd5r1cXa9vJhYAYXhF3E+SSE_GeA@mail.gmail.com","threadId":"40200","inReplyTo":"CAEBDL5UQSvS=t1dUKYqK6R=xHU6RU3bS72w-i02ey-Y_VB9KMQ@mail.gmail.com","subject":"Re: Bug with worktrees...","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-08-28T02:55:33Z","receivedAt":"2015-08-28T02:55:33Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Aug 27, 2015 at 3:03 PM, John Szakmeister <john@szakmeister.net> wrote:\n> My apologies if this has already been reported, but I ran into an\n> interesting bug with worktrees.  In particular, I have an alias 'st'\n> that maps to 'status -sb'.  When running this under a subdirectory of\n> a worktree created with 'git worktree add', it fails complaining that\n> the work tree has already been set.\n>\n> Here's a script to reproduce the problem:\n>     git init test-repo\n>     cd test-repo\n>     git config --local alias.st 'status -sb'\n>     mkdir subdir\n>     echo file > subdir/file.txt\n>     git add subdir/file.txt\n>     git commit -m 'add file'\n>     git branch foo\n>     git worktree add ../new-worktree foo\n>     cd ../new-worktree/subdir\n>     echo \"new line\" >> file.txt\n>     echo \"this will work\"\n>     git status -sb\n>     echo \"this fails\"\n>     git st\n>\n> When I run it, I see this:\n> [...]\n> fatal: internal error: work tree has already been set\n> Current worktree: /home/jszakmeister/tmp/test-case/new-worktree\n> New worktree: /home/jszakmeister/tmp/test-case/new-worktree/subdir\n\nI can reproduce with 2.5.0 but not 'master'. Bisection reveals that\nthis was fixed by d95138e (setup: set env $GIT_WORK_TREE when work\ntree is set, like $GIT_DIR, 2015-06-26), and was reported previously\nhere [1].\n\n[1]: http://git.661346.n2.nabble.com/Linked-workdirs-break-typo-correction-td7634347.html\n"},{"id":"268833","messageId":"CAEBDL5W9Ly_tsE35OG+MGZkA0V41FEoewZTWk9EPZxXQHnRF6A@mail.gmail.com","threadId":"40200","inReplyTo":"CAPig+cTkeOywRH1-_4Zi9jOd5r1cXa9vJhYAYXhF3E+SSE_GeA@mail.gmail.com","subject":"Re: Bug with worktrees...","fromName":"John Szakmeister","fromEmail":"john@szakmeister.net","sentAt":"2015-08-28T10:27:46Z","receivedAt":"2015-08-28T10:27:46Z","isPatch":false,"sender":{"key":"john@szakmeister.net","avatar":"https://avatars.githubusercontent.com/u/448087?v=4"},"body":"On Thu, Aug 27, 2015 at 10:55 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n[snip]\n> I can reproduce with 2.5.0 but not 'master'. Bisection reveals that\n> this was fixed by d95138e (setup: set env $GIT_WORK_TREE when work\n> tree is set, like $GIT_DIR, 2015-06-26), and was reported previously\n> here [1].\n\nI had done a quick search but didn't turn up that thread.  Thank you Eric!\n\n-John\n"}]}