From: Martin Schön Date: Mon, 2 Jul 2018 13:28:09 +0000 (+0200) Subject: git-gui: use commit message template X-Git-Tag: v2.30.0-rc1~9^2~6^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=627c87f84c157885d587125cf0c73591a0e3ee7a;p=thirdparty%2Fgit.git git-gui: use commit message template Use the file described by commit.template (if set) to show the commit message template, just like other GUIs. Signed-off-by: Martin Schön Signed-off-by: Pratyush Yadav --- diff --git a/git-gui.sh b/git-gui.sh index 8ee67e6f09..cc6c2aa2c3 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1482,6 +1482,7 @@ proc rescan {after {honor_trustmtime 1}} { } elseif {[run_prepare_commit_msg_hook]} { } elseif {[load_message MERGE_MSG]} { } elseif {[load_message SQUASH_MSG]} { + } elseif {[load_message [get_config commit.template]]} { } $ui_comm edit reset $ui_comm edit modified false @@ -1616,6 +1617,12 @@ proc run_prepare_commit_msg_hook {} { fconfigure $fd_sm -encoding utf-8 puts -nonewline $fd_pcm [read $fd_sm] close $fd_sm + } elseif {[file isfile [get_config commit.template]]} { + set pcm_source "template" + set fd_sm [open [get_config commit.template] r] + fconfigure $fd_sm -encoding utf-8 + puts -nonewline $fd_pcm [read $fd_sm] + close $fd_sm } else { set pcm_source "" } diff --git a/lib/commit.tcl b/lib/commit.tcl index b516aa2990..11379f8ad3 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -456,6 +456,7 @@ A rescan will be automatically started now. } $ui_comm delete 0.0 end + load_message [get_config commit.template] $ui_comm edit reset $ui_comm edit modified false if {$::GITGUI_BCK_exists} {