{"action":"created","issue":{"url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/278","labels_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/278/comments","events_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/278/events","html_url":"https://github.com/airblade/vim-gitgutter/issues/278","id":114505513,"number":278,"title":"Missing update on :Gwrite","user":{"login":"somini","id":1750665,"avatar_url":"https://avatars.githubusercontent.com/u/1750665?v=3","gravatar_id":"","url":"https://api.github.com/users/somini","html_url":"https://github.com/somini","followers_url":"https://api.github.com/users/somini/followers","following_url":"https://api.github.com/users/somini/following{/other_user}","gists_url":"https://api.github.com/users/somini/gists{/gist_id}","starred_url":"https://api.github.com/users/somini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/somini/subscriptions","organizations_url":"https://api.github.com/users/somini/orgs","repos_url":"https://api.github.com/users/somini/repos","events_url":"https://api.github.com/users/somini/events{/privacy}","received_events_url":"https://api.github.com/users/somini/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-02T00:52:05Z","updated_at":"2015-11-04T10:41:33Z","closed_at":null,"body":"If you use [vim-fugitive], it provides useful commands such as `Gwrite` that stage the file and save the buffer. The only problem is that the gutter is not updated.\r\n\r\nAs of now, my \"workaround\" is saving the buffer afterwards, so that the autocmds kick in and update the buffer. I think that plugin is doing some kind of wizardry to save buffers without triggering autocmds.\r\n\r\nMight be related to https://github.com/tpope/vim-fugitive/issues/348\r\n\r\n[vim-fugitive]: https://github.com/tpope/vim-fugitive/blob/master/plugin/fugitive.vim#L1436"},"comment":{"url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/comments/153680425","html_url":"https://github.com/airblade/vim-gitgutter/issues/278#issuecomment-153680425","issue_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/278","id":153680425,"user":{"login":"airblade","id":7265,"avatar_url":"https://avatars.githubusercontent.com/u/7265?v=3","gravatar_id":"","url":"https://api.github.com/users/airblade","html_url":"https://github.com/airblade","followers_url":"https://api.github.com/users/airblade/followers","following_url":"https://api.github.com/users/airblade/following{/other_user}","gists_url":"https://api.github.com/users/airblade/gists{/gist_id}","starred_url":"https://api.github.com/users/airblade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airblade/subscriptions","organizations_url":"https://api.github.com/users/airblade/orgs","repos_url":"https://api.github.com/users/airblade/repos","events_url":"https://api.github.com/users/airblade/events{/privacy}","received_events_url":"https://api.github.com/users/airblade/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T10:41:33Z","updated_at":"2015-11-04T10:41:33Z","body":"Here's what I've found so far:\r\n\r\n1. vim-gitgutter picks up the `BufWritePost` autocommand fired by vim-fugitive.\r\n2. After the autocommand is noticed, but before vim-gitgutter starts to do its thing, `git-diff` still shows the pre-`Gwrite` diff.\r\n3. After vim-gitgutter has run, `git-diff` reports no changes.\r\n\r\n(1) and (3) are expected.  (2) is surprising.  I found (2) by inserting a `sleep 10` above [this line](https://github.com/airblade/vim-gitgutter/blob/b18e23cdfa082dee7da8a2466db5a66907491e5b/plugin/gitgutter.vim#L174) in vim-gitgutter's autocommand, then running the following command in a different terminal once the sleep started:\r\n\r\n```sh\r\ngit diff --no-ext-diff --no-color -U0  -- Gemfile\r\n```\r\n\r\nWhen run during the sleep, the diff was the same as it was before doing `:Gwrite`.  When run after vim-gitgutter had finished, the diff was empty.\r\n\r\nRegarding (2), vim-fugitive [updates git's index](https://github.com/tpope/vim-fugitive/blob/f096152a48bc2506bd460c9f990e50a159a7bbc5/plugin/fugitive.vim#L2142-2171) via `git-update-index`.  I would expect `git-diff` to be 'up to date' once `git-update-index` has returned but I don't know anything about the latter command..."}}