Skip to content

Commit 627c87f

Browse files
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 <[email protected]> Signed-off-by: Pratyush Yadav <[email protected]>
1 parent ce83ab2 commit 627c87f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

git-gui.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,6 +1482,7 @@ proc rescan {after {honor_trustmtime 1}} {
14821482
} elseif {[run_prepare_commit_msg_hook]} {
14831483
} elseif {[load_message MERGE_MSG]} {
14841484
} elseif {[load_message SQUASH_MSG]} {
1485+
} elseif {[load_message [get_config commit.template]]} {
14851486
}
14861487
$ui_comm edit reset
14871488
$ui_comm edit modified false
@@ -1616,6 +1617,12 @@ proc run_prepare_commit_msg_hook {} {
16161617
fconfigure $fd_sm -encoding utf-8
16171618
puts -nonewline $fd_pcm [read $fd_sm]
16181619
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
16191626
} else {
16201627
set pcm_source ""
16211628
}

lib/commit.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ A rescan will be automatically started now.
456456
}
457457

458458
$ui_comm delete 0.0 end
459+
load_message [get_config commit.template]
459460
$ui_comm edit reset
460461
$ui_comm edit modified false
461462
if {$::GITGUI_BCK_exists} {

0 commit comments

Comments
 (0)