git-gui: fix initial git gui message encoding

This fix refers https://github.com/git-for-windows/git/issues/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 <yaras6@gmail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

yaras committed Feb 23, 2016 at 11:55 UTC af465c0c28d2b299c08613e97d6df0ec23d86fbb
1 file changed +2
git-gui.sh
+2
@@ -1616,11 +1616,13 @@ proc run_prepare_commit_msg_hook {} {
1616 if {[file isfile [gitdir MERGE_MSG]]} {
1617 set pcm_source "merge"
1618 set fd_mm [open [gitdir MERGE_MSG] r]
1619 + fconfigure $fd_mm -encoding utf-8
1620 puts -nonewline $fd_pcm [read $fd_mm]
1621 close $fd_mm
1622 } elseif {[file isfile [gitdir SQUASH_MSG]]} {
1623 set pcm_source "squash"
1624 set fd_sm [open [gitdir SQUASH_MSG] r]
1625 + fconfigure $fd_sm -encoding utf-8
1626 puts -nonewline $fd_pcm [read $fd_sm]
1627 close $fd_sm
1628 } else {