Skip to content
Snippets Groups Projects
Commit e3ed11f3 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

plugin/magit.vim: fix template commit duplicate on refresh

On refresh, fill commit message my default one if empty, or current one, not both

fix #135
parent 2bdd7cde
No related branches found
No related tags found
No related merge requests found
...@@ -185,14 +185,13 @@ function! s:mg_get_commit_section() ...@@ -185,14 +185,13 @@ function! s:mg_get_commit_section()
silent! call magit#utils#system("GIT_EDITOR=/bin/false " . silent! call magit#utils#system("GIT_EDITOR=/bin/false " .
\ g:magit_git_cmd . " -c commit.verbose=no commit --amend -e 2> /dev/null") \ g:magit_git_cmd . " -c commit.verbose=no commit --amend -e 2> /dev/null")
endif 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 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 . '"')) let commit_msg=magit#utils#join_list(filter(readfile(git_dir . 'COMMIT_EDITMSG'), 'v:val !~ "^' . comment_char . '"'))
silent put =commit_msg silent put =commit_msg
endif endif
if ( !empty(b:magit_current_commit_msg) )
silent put =b:magit_current_commit_msg
endif
silent put ='' silent put =''
silent put ='' silent put =''
endif endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment