Invalid initial git gui message encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

Working with Git for Windows on git gui I noticed an issue on reading
initial message to git gui message prompt after squash or cherry-pick
conflict. When system encoding is not set to UTF-8 (and on my Windows
it is cp1250) squash/cherry pick conflict message gets invalid
encoding.

This issue and test case is more widely described on
https://github.com/git-for-windows/git/issues/664 . After I set
encoding to UTF-8 using fconfigure, the problem seems to be fixed.

I tried it also on Linux, but I cannot reproduce this problem as its
default encoding is utf-8. I verified it using simple tcl script:
"puts [encoding system]". On Windows I get:

$ tclsh enc.tcl
cp1250

on Linux:

$ tclsh enc.tcl
utf-8

It may be not a big issue for Linux, but I think it is worth to have
it merged in case of somebody had other encoding than UTF-8. This fix
has been already merged into Git for Windows.

As stated in Documentation/SubmittingPatches, this patch is based on
git://repo.or.cz/git-gui.git.

BTW. Is there any example of writing regression tests for git-gui?

Signed-off-by: yaras <yaras6@xxxxxxxxx>
---
 git-gui.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/git-gui.sh b/git-gui.sh
index 11048c7..1ed5185 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1616,11 +1616,13 @@ proc run_prepare_commit_msg_hook {} {
  if {[file isfile [gitdir MERGE_MSG]]} {
  set pcm_source "merge"
  set fd_mm [open [gitdir MERGE_MSG] r]
+ fconfigure $fd_mm -encoding utf-8
  puts -nonewline $fd_pcm [read $fd_mm]
  close $fd_mm
  } elseif {[file isfile [gitdir SQUASH_MSG]]} {
  set pcm_source "squash"
  set fd_sm [open [gitdir SQUASH_MSG] r]
+ fconfigure $fd_sm -encoding utf-8
  puts -nonewline $fd_pcm [read $fd_sm]
  close $fd_sm
  } else {
--
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]