{"action":"created","issue":{"url":"https://api.github.com/repos/tpope/vim-fugitive/issues/671","labels_url":"https://api.github.com/repos/tpope/vim-fugitive/issues/671/labels{/name}","comments_url":"https://api.github.com/repos/tpope/vim-fugitive/issues/671/comments","events_url":"https://api.github.com/repos/tpope/vim-fugitive/issues/671/events","html_url":"https://github.com/tpope/vim-fugitive/pull/671","id":98306590,"number":671,"title":"[WIP] Detect 'git worktree add' checkouts","user":{"login":"mathstuf","id":97253,"avatar_url":"https://avatars.githubusercontent.com/u/97253?v=3","gravatar_id":"","url":"https://api.github.com/users/mathstuf","html_url":"https://github.com/mathstuf","followers_url":"https://api.github.com/users/mathstuf/followers","following_url":"https://api.github.com/users/mathstuf/following{/other_user}","gists_url":"https://api.github.com/users/mathstuf/gists{/gist_id}","starred_url":"https://api.github.com/users/mathstuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathstuf/subscriptions","organizations_url":"https://api.github.com/users/mathstuf/orgs","repos_url":"https://api.github.com/users/mathstuf/repos","events_url":"https://api.github.com/users/mathstuf/events{/privacy}","received_events_url":"https://api.github.com/users/mathstuf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-07-31T03:00:18Z","updated_at":"2015-08-10T04:17:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tpope/vim-fugitive/pulls/671","html_url":"https://github.com/tpope/vim-fugitive/pull/671","diff_url":"https://github.com/tpope/vim-fugitive/pull/671.diff","patch_url":"https://github.com/tpope/vim-fugitive/pull/671.patch"},"body":"The worktree feature of 2.5.0 stores a slimmed down .git directory under\r\nthe real .git directory:\r\n\r\n    .git/worktree/$name\r\n\r\nUnder this directory, the files we care about:\r\n\r\n    commondir -> relative path to the common .git directory\r\n    gitdir -> absolute path to the .git file in the new worktree\r\n    gitfile -> relative path to the .git file from the main worktree\r\n\r\nFixes #655."},"comment":{"url":"https://api.github.com/repos/tpope/vim-fugitive/issues/comments/129294108","html_url":"https://github.com/tpope/vim-fugitive/pull/671#issuecomment-129294108","issue_url":"https://api.github.com/repos/tpope/vim-fugitive/issues/671","id":129294108,"user":{"login":"jwhitley","id":44155,"avatar_url":"https://avatars.githubusercontent.com/u/44155?v=3","gravatar_id":"","url":"https://api.github.com/users/jwhitley","html_url":"https://github.com/jwhitley","followers_url":"https://api.github.com/users/jwhitley/followers","following_url":"https://api.github.com/users/jwhitley/following{/other_user}","gists_url":"https://api.github.com/users/jwhitley/gists{/gist_id}","starred_url":"https://api.github.com/users/jwhitley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwhitley/subscriptions","organizations_url":"https://api.github.com/users/jwhitley/orgs","repos_url":"https://api.github.com/users/jwhitley/repos","events_url":"https://api.github.com/users/jwhitley/events{/privacy}","received_events_url":"https://api.github.com/users/jwhitley/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T04:17:57Z","updated_at":"2015-08-10T04:17:57Z","body":"Some working notes as I dig in.\r\n\r\nThe places `b:git_dir` is assigned in the `git-workdir-support` branch are in:\r\n\r\n1.  [`fugitive#detect()` at L201](https://github.com/mathstuf/vim-fugitive/blob/git-workdir-support/plugin/fugitive.vim#L201)\r\n2.  [`s:BufReadIndex()` at L2460](https://github.com/mathstuf/vim-fugitive/blob/git-workdir-support/plugin/fugitive.vim#L2460)\r\n3.  [`s:BufReadIndexFile()` at L2552`](https://github.com/mathstuf/vim-fugitive/blob/git-workdir-support/plugin/fugitive.vim#L2552)\r\n4.  [`s:BufReadObject()` at L2606](https://github.com/mathstuf/vim-fugitive/blob/git-workdir-support/plugin/fugitive.vim#L2606)\r\n5.  [`autocmd BufNewFile,BufReadPost *` at L2715](https://github.com/mathstuf/vim-fugitive/blob/git-workdir-support/plugin/fugitive.vim#L2715)\r\n\r\nThe BufRead* functions all set from `s:repo().dir()`.  IIRC, that's covered by this patch already.\r\n\r\nThe autocmd is set from an element of `s:temp_files`, the `dir` element of which is initialized in two places, by `buffer.repo().dir()` (L1394) and `s:repo().dir()` (L1995), so that also seems to be covered by changes to the repo class.\r\n\r\nThat leaves `fugitive#detect()`, which in turn depends on `fugitive#extract_git_dir()`.\r\n"}}