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 <Martin.Schoen@loewensteinmedical.de> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Martin Schön committed Jul 2, 2018 at 15:28 UTC 627c87f84c157885d587125cf0c73591a0e3ee7a
2 files changed +8
git-gui.sh
+7
@@ -1482,6 +1482,7 @@ proc rescan {after {honor_trustmtime 1}} {
1482 } elseif {[run_prepare_commit_msg_hook]} {
1483 } elseif {[load_message MERGE_MSG]} {
1484 } elseif {[load_message SQUASH_MSG]} {
1485 + } elseif {[load_message [get_config commit.template]]} {
1486 }
1487 $ui_comm edit reset
1488 $ui_comm edit modified false
@@ -1616,6 +1617,12 @@ proc run_prepare_commit_msg_hook {} {
1617 fconfigure $fd_sm -encoding utf-8
1618 puts -nonewline $fd_pcm [read $fd_sm]
1619 close $fd_sm
1620 + } elseif {[file isfile [get_config commit.template]]} {
1621 + set pcm_source "template"
1622 + set fd_sm [open [get_config commit.template] r]
1623 + fconfigure $fd_sm -encoding utf-8
1624 + puts -nonewline $fd_pcm [read $fd_sm]
1625 + close $fd_sm
1626 } else {
1627 set pcm_source ""
1628 }
lib/commit.tcl
+1
@@ -456,6 +456,7 @@ A rescan will be automatically started now.
456 }
457
458 $ui_comm delete 0.0 end
459 + load_message [get_config commit.template]
460 $ui_comm edit reset
461 $ui_comm edit modified false
462 if {$::GITGUI_BCK_exists} {