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.

Steps to reproduce:

  git init .
  echo 'a' > a && git add . && git commit -m 'added A'
  git checkout -b devel
  echo 'b' > b && git add . && git commit -m 'added B (ęóąśłżźćń)'
  echo 'bbb' >> b && git add . && git commit -m 'changed B (żźćńąśłóę)'
  git checkout master
  git merge --squash devel

after above commands I run git gui where I get initial message with
invalid encoding. I described it more widely on github:
https://github.com/git-for-windows/git/issues/664#issuecomment-187664072.

I prepared a fix on https://github.com/git-for-windows/git/pull/665.
Before I send a patch based on git://repo.or.cz/git-gui.git may I ask
you to review my changes? I also attach them to this message below.

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 1834f00..5771973 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -1599,11 +1599,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 {

---
Yours sincerely,
Jarek Z.
--
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]