Skip to content

Commit 1b893fc

Browse files
yarasdscho
authored andcommitted
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 e5ae629 commit 1b893fc

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
@@ -1616,11 +1616,13 @@ proc run_prepare_commit_msg_hook {} {
16161616
if {[file isfile [gitdir MERGE_MSG]]} {
16171617
set pcm_source "merge"
16181618
set fd_mm [open [gitdir MERGE_MSG] r]
1619+
fconfigure $fd_mm -encoding utf-8
16191620
puts -nonewline $fd_pcm [read $fd_mm]
16201621
close $fd_mm
16211622
} elseif {[file isfile [gitdir SQUASH_MSG]]} {
16221623
set pcm_source "squash"
16231624
set fd_sm [open [gitdir SQUASH_MSG] r]
1625+
fconfigure $fd_sm -encoding utf-8
16241626
puts -nonewline $fd_pcm [read $fd_sm]
16251627
close $fd_sm
16261628
} else {

0 commit comments

Comments
 (0)