From 34eaa17ba3f5330fbcf685e48530fb572b11de32 Mon Sep 17 00:00:00 2001
From: Jerome Reybert <jerome.reybert@tiempo-secure.com>
Date: Thu, 5 May 2022 11:50:46 +0200
Subject: [PATCH] Force git commit cleanup

Since 'Update mg_get_commit_section function', git commit
message cleanup is done by git itself, not by vimagit.

git commit does cleanup by default. But cleanup default
is not the same when commit message is not edited (which
is how vimagit works).

Then, cleanup option is forced to 'strip', unless
commit.cleanup option is set.

Fixes #196
---
 plugin/magit.vim | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugin/magit.vim b/plugin/magit.vim
index 8028b60..b201519 100644
--- a/plugin/magit.vim
+++ b/plugin/magit.vim
@@ -348,7 +348,8 @@ function! s:mg_git_commit(mode) abort
 			echoerr "Commit fix failed"
 		endtry
 	else
-		let commit_flag=""
+		let cleanup_cfg = magit#git#get_config('commit.cleanup', 'strip')
+		let commit_flag=" --cleanup=" . cleanup_cfg . " "
 		if ( a:mode != 'CA' && empty( magit#get_staged_files() ) )
 			let choice = confirm(
 				\ "Do you really want to commit without any staged files?",
-- 
GitLab