git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Invalid initial git gui message encoding

From
JZjarek z. <yaras6@gmail.com>
Date
Feb 23, 2016, 18:36 UTC
Message-ID
<CABvS4Ogs9biYxs-yNVxO9S5_nWiKcUO8dySWHWEfFAyaqCviJg@mail.gmail.com>
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.
Message 1 of 1 in “Invalid initial git gui message encoding”
  1. jarek z.Feb 23, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.