Skip to content

Commit

Permalink
plugin/magit.vim: fix template commit duplicate on refresh
Browse files Browse the repository at this point in the history
On refresh, fill commit message my default one if empty, or current one, not both

fix #135
  • Loading branch information
jreybert committed May 23, 2017
1 parent 2bdd7cd commit e3ed11f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plugin/magit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,13 @@ function! s:mg_get_commit_section()
silent! call magit#utils#system("GIT_EDITOR=/bin/false " .
\ g:magit_git_cmd . " -c commit.verbose=no commit --amend -e 2> /dev/null")
endif
if ( filereadable(git_dir . 'COMMIT_EDITMSG') )
if ( !empty(b:magit_current_commit_msg) )
silent put =b:magit_current_commit_msg
elseif ( filereadable(git_dir . 'COMMIT_EDITMSG') )
let comment_char=magit#git#get_config("core.commentChar", '#')
let commit_msg=magit#utils#join_list(filter(readfile(git_dir . 'COMMIT_EDITMSG'), 'v:val !~ "^' . comment_char . '"'))
silent put =commit_msg
endif
if ( !empty(b:magit_current_commit_msg) )
silent put =b:magit_current_commit_msg
endif
silent put =''
silent put =''
endif
Expand Down

0 comments on commit e3ed11f

Please sign in to comment.