Write buffer before staging whole file

We stage the whole file with `git-add` so we must ensure the file on
disk reflects the buffer's contents.

See #796.
This commit is contained in:
Andy Stewart
2023-06-05 10:50:17 +01:00
parent 278b393e68
commit a202921235

View File

@@ -299,6 +299,9 @@ function! s:stage(hunk_diff)
let choice = input('File uses clean/smudge filter. Stage entire file (y/n)? ') let choice = input('File uses clean/smudge filter. Stage entire file (y/n)? ')
normal! :<ESC> normal! :<ESC>
if choice =~ 'y' if choice =~ 'y'
" We are about to add the file to the index so write the buffer to
" ensure the file on disk matches it (the buffer).
write
let path = gitgutter#utility#repo_path(bufnr, 1) let path = gitgutter#utility#repo_path(bufnr, 1)
" Add file to index. " Add file to index.
let cmd = gitgutter#utility#cd_cmd(bufnr, let cmd = gitgutter#utility#cd_cmd(bufnr,