{"action":"created","issue":{"url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/494","repository_url":"https://api.github.com/repos/airblade/vim-gitgutter","labels_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/494/labels{/name}","comments_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/494/comments","events_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/494/events","html_url":"https://github.com/airblade/vim-gitgutter/issues/494","id":301457747,"number":494,"title":"Staging hunk is not working.","user":{"login":"shea-parkes","id":5782892,"avatar_url":"https://avatars2.githubusercontent.com/u/5782892?v=4","gravatar_id":"","url":"https://api.github.com/users/shea-parkes","html_url":"https://github.com/shea-parkes","followers_url":"https://api.github.com/users/shea-parkes/followers","following_url":"https://api.github.com/users/shea-parkes/following{/other_user}","gists_url":"https://api.github.com/users/shea-parkes/gists{/gist_id}","starred_url":"https://api.github.com/users/shea-parkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shea-parkes/subscriptions","organizations_url":"https://api.github.com/users/shea-parkes/orgs","repos_url":"https://api.github.com/users/shea-parkes/repos","events_url":"https://api.github.com/users/shea-parkes/events{/privacy}","received_events_url":"https://api.github.com/users/shea-parkes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-01T15:55:48Z","updated_at":"2018-03-01T18:34:29Z","closed_at":null,"author_association":"NONE","body":"> What is the latest commit SHA in your installed vim-gitgutter?\r\n```\r\ncommit b27ee4d602d7ce6f7b7caf8e9ecb8eded57ffe0a (HEAD -> master, origin/master, origin/HEAD)\r\nAuthor: Andy Stewart <boss@airbladesoftware.com>\r\nDate:   Thu Feb 22 16:23:17 2018 +0000\r\n\r\n    Rename variable for clarity.\r\n```\r\n\r\n> What vim/nvim version are you on?\r\nNVIM v0.2.2 on Windows 10\r\n\r\n> If no signs are showing at all, what does `:echo b:gitgutter.path` give?\r\nSigns are showing fine.\r\n\r\n> If no signs are showing at all, and the `path` value is a path and not `-2`, does it work with `let g:gitgutter_grep=''`?\r\nSigns are showing fine.\r\n\r\n\r\nI'm not able to stage a hunk.  I believe the issue is related to the creation of the patch diff.  It's not being ~mutated to look like it applies to the real files.  Here's the output from `gitgutter.log`:\r\n```\r\n2066.327010 function gitgutter#hunk#stage[1]..<SNR>70_hunk_op[6]..gitgutter#diff#run_diff[74]..gitgutter#utility#system[1]:\r\n2066.327010 cd \"C:\\Users\\shea.parkes\\nvim\" && (git --no-pager show :init.vim > C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim && git --no-pager -c \"diff.autorefreshindex=0\" -c \"diff.noprefix=false\" -c \"core.safecrlf=false\" diff --no-ext-diff --no-color -U0  -- C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\12.1.vim || exit 0)\r\n\r\n2066.432263 function gitgutter#hunk#stage[1]..<SNR>70_hunk_op[14]..<SNR>70_stage[4]..gitgutter#utility#system[1]:\r\n2066.432263 cd \"C:\\Users\\shea.parkes\\nvim\" && git apply --cached --unidiff-zero - \r\n2066.432263 [diff --git \"a/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\11.1.vim\" \"b/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\12.1.vim\"\r\nindex f42aeb0..4930403 100644\r\n--- \"a/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\11.1.vim\"\r\n+++ \"b/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\12.1.vim\"\r\n@@ -172,0 +173 @@ nnoremap <Leader>gc :Gcommit --verbose<CR>\r\n+nnoremap <Leader>gd :Gdiff<CR>\r\n]\r\n\r\n2066.514006 function gitgutter#hunk#stage[1]..<SNR>70_hunk_op[14]..<SNR>70_stage[9]..gitgutter#process_buffer[8]..gitgutter#diff#run_diff[67]..gitgutter#async#execute[1]:\r\n2066.514006 [async] cd \"C:\\Users\\shea.parkes\\nvim\" && (git --no-pager show :init.vim > C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim && git --no-pager -c \"diff.autorefreshindex=0\" -c \"diff.noprefix=false\" -c \"core.safecrlf=false\" diff --no-ext-diff --no-color -U0  -- C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\12.1.vim | grep \"^@@ \" || exit 0)\r\n\r\n2066.691090 function <SNR>85_on_exit_nvim[2]..gitgutter#diff#handler[1]:\r\n2066.691090 @@ -172,0 +173 @@ nnoremap <Leader>gc :Gcommit --verbose<CR>\r\n```\r\n\r\nFor context, I'm trying to stage a change that's in my own `~/nvim/init.vim`.  I saved the patch-diff above to a file and ran the `git apply` in powershell to get the following error:\r\n```\r\nC:\\Users\\shea.parkes\\nvim [master ≡ +0 ~1 -0 !]> git apply --cached --unidiff-zero $env:temp\\nvimJcmSv9\\diff.txt\r\nC:/Users/SHEA~1.PAR/AppData/Local/Temp/nvimJcmSv9/diff.txt:6: trailing whitespace.\r\nnnoremap <Leader>gd :Gdiff<CR>\r\nerror: C:\\Users\\SHEA~1.PAR\\AppData\\Local\\Temp\\nvimJcmSv9\\11.1.vim: does not exist in index\r\nC:\\Users\\shea.parkes\\nvim [master ≡ +0 ~1 -0 !]>\r\n```\r\nI thought the whitespace warning was likely some CRLF/LF mess when I saved the generated diff, and the \"does not exist in index\" sounds like the real culprit.  I tried to read the source code to understand if the filepath is supposed to be mutated, and I ultimately decided that I thought it should have been.  Alas, vimscript is not my strong suit, so I couldn't be sure.\r\n\r\nHappy to provide any additional details upon request.\r\n"},"comment":{"url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/comments/369686895","html_url":"https://github.com/airblade/vim-gitgutter/issues/494#issuecomment-369686895","issue_url":"https://api.github.com/repos/airblade/vim-gitgutter/issues/494","id":369686895,"user":{"login":"shea-parkes","id":5782892,"avatar_url":"https://avatars2.githubusercontent.com/u/5782892?v=4","gravatar_id":"","url":"https://api.github.com/users/shea-parkes","html_url":"https://github.com/shea-parkes","followers_url":"https://api.github.com/users/shea-parkes/followers","following_url":"https://api.github.com/users/shea-parkes/following{/other_user}","gists_url":"https://api.github.com/users/shea-parkes/gists{/gist_id}","starred_url":"https://api.github.com/users/shea-parkes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shea-parkes/subscriptions","organizations_url":"https://api.github.com/users/shea-parkes/orgs","repos_url":"https://api.github.com/users/shea-parkes/repos","events_url":"https://api.github.com/users/shea-parkes/events{/privacy}","received_events_url":"https://api.github.com/users/shea-parkes/received_events","type":"User","site_admin":false},"created_at":"2018-03-01T18:34:29Z","updated_at":"2018-03-01T18:34:29Z","author_association":"NONE","body":"Thanks for looking into this.  To answer the first question, the contents of `diff.txt` were pulled from the log above:\r\n```\r\ndiff --git \"a/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\11.1.vim\" \"b/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\12.1.vim\"\r\nindex f42aeb0..4930403 100644\r\n--- \"a/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\11.1.vim\"\r\n+++ \"b/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\12.1.vim\"\r\n@@ -172,0 +173 @@ nnoremap <Leader>gc :Gcommit --verbose<CR>\r\n+nnoremap <Leader>gd :Gdiff<CR>\r\n```\r\n\r\nI tried out your suggested and change and looks like the regex failed to hit anything.  The specific error it threw was `E874: (NFA) Could not pop the stack !`\r\n\r\nI tried to get it down to a reproducible example of a single function call.  I stripped the beginning and end of the regex to try and make it work against a string literal:\r\n```\r\necho matchlist('diff --git \"a/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\11.1.vim\" \"b/C:\\\\Users\\\\SHEA~1.PAR\\\\AppData\\\\Local\\\\Temp\\\\nvimJcmSv9\\\\12.1.vim\"', 'diff --git \"./(\\S+)\" \"./(\\S+)\"')\r\n```\r\nthe above returned an empty list.  I'll futz a bit with the regex shortly to see if I can get it to capture correctly.  Any further help is of course appreciate.  Thanks for making such a great tool and being willing to help on a NVim+Win10 setup (which I'm assuming isn't that common).\r\n\r\n"}}
{"actor":{"display_login":"shea-parkes"}}