]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: use commit message template
authorMartin Schön <Martin.Schoen@loewensteinmedical.de>
Mon, 2 Jul 2018 13:28:09 +0000 (15:28 +0200)
committerPratyush Yadav <me@yadavpratyush.com>
Fri, 27 Nov 2020 14:36:38 +0000 (20:06 +0530)
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 <Martin.Schoen@loewensteinmedical.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
git-gui.sh
lib/commit.tcl

index 8ee67e6f09771bf3ad0e878126c3aa3ac1c85f62..cc6c2aa2c3bed1dc985111a7527b9cdec904add4 100755 (executable)
@@ -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 ""
        }
index b516aa29906911a6984f2e9ea539c2e25d23ae66..11379f8ad355e2ea2a7cf1645bc31543508731ab 100644 (file)
@@ -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} {