Skip to content

Commit

Permalink
Write buffer before staging whole file
Browse files Browse the repository at this point in the history
We stage the whole file with `git-add` so we must ensure the file on
disk reflects the buffer's contents.

See airblade#796.
  • Loading branch information
airblade committed Jun 5, 2023
1 parent 278b393 commit a202921
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autoload/gitgutter/hunk.vim
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ function! s:stage(hunk_diff)
let choice = input('File uses clean/smudge filter. Stage entire file (y/n)? ')
normal! :<ESC>
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)
" Add file to index.
let cmd = gitgutter#utility#cd_cmd(bufnr,
Expand Down

0 comments on commit a202921

Please sign in to comment.