Skip to content
Browse files

plugin/git.vim: Save current buffer before commit.

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...
1 parent 73a1817 commit 96605e8552c99a6f0fa5fc63e4f4c65828832e88 @runpaint committed May 14, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 plugin/git.vim
View
5 plugin/git.vim
@@ -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 = ''

0 comments on commit 96605e8

Please sign in to comment.
Something went wrong with that request. Please try again.