Skip to content

Commit eb8ed4b

Browse files
committed
Fix initial git gui message encoding
This fix refers #664 After `git merge --squash` git creates .git/SQUASH_MSG (UTF-8 encoded) which contains squashed commits. When run `git gui` it copies SQUASH_MSG to PREPARE_COMMIT_MSG, but without honoring UTF-8. This leads to encoding problems on `git gui` commit prompt. The same applies on git cherry-pick conflict, where MERGE_MSG is created and then is copied to PREPARE_COMMIT_MSG. In both cases PREPARE_COMMIT_MSG must be configured to store data in UTF-8. Signed-off-by: yaras <[email protected]>
1 parent 5243a88 commit eb8ed4b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

git-gui/git-gui.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,11 +1599,13 @@ proc run_prepare_commit_msg_hook {} {
15991599
if {[file isfile [gitdir MERGE_MSG]]} {
16001600
set pcm_source "merge"
16011601
set fd_mm [open [gitdir MERGE_MSG] r]
1602+
fconfigure $fd_mm -encoding utf-8
16021603
puts -nonewline $fd_pcm [read $fd_mm]
16031604
close $fd_mm
16041605
} elseif {[file isfile [gitdir SQUASH_MSG]]} {
16051606
set pcm_source "squash"
16061607
set fd_sm [open [gitdir SQUASH_MSG] r]
1608+
fconfigure $fd_sm -encoding utf-8
16071609
puts -nonewline $fd_pcm [read $fd_sm]
16081610
close $fd_sm
16091611
} else {

0 commit comments

Comments
 (0)