Skip to content

Commit

Permalink
plugin/git.vim: Save current buffer before commit.
Browse files Browse the repository at this point in the history
Previously, GitCommit didn't save the current buffer, meaning that changes
since the last save weren't reflected in the commit. This fix is hopefully
more consistent with user expectations.
  • Loading branch information
runpaint committed May 14, 2009
1 parent 73a1817 commit 96605e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/git.vim
Expand Up @@ -125,13 +125,16 @@ endfunction
" Commit.
function! GitCommit(args)
let git_dir = <SID>GetGitDir()

let args = a:args

if args !~ '\v\k@<!(-a|--all)>' && s:SystemGit('diff --cached --stat') =~ '^\(\s\|\n\)*$'
let args .= ' -a'
endif

" Save current buffer so Git sees your changes
execute (":w")

" Create COMMIT_EDITMSG file
let editor_save = $EDITOR
let $EDITOR = ''
Expand Down

0 comments on commit 96605e8

Please sign in to comment.