From 4dc0e1ca4176ddfe0ec66cf771fe0a71259a13a5 Mon Sep 17 00:00:00 2001 From: Jerome Reybert <jreybert@gmail.com> Date: Tue, 23 May 2017 23:08:59 +0200 Subject: [PATCH] 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 --- plugin/magit.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugin/magit.vim b/plugin/magit.vim index 7f8aa27..2f9abeb 100644 --- a/plugin/magit.vim +++ b/plugin/magit.vim @@ -184,14 +184,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 ='' endif endfunction -- GitLab