Skip to content

gitk: Fixing file name encoding issues #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

kkato233
Copy link
Contributor

fix: file name encoding issues.
fix: when resolving merge conflicts, japanese file names become garbled.

Cc: Johannes Sixt [email protected]

@kkato233
Copy link
Contributor Author

encoding system utf-8

Handling UTF-8 encoding for file names in parameters when wish executes git commands.

https://www.tcl.tk/man/tcl/TclCmd/encoding.htm

encoding system ?encoding?
Set the system encoding to encoding. 
If encoding is omitted then the command returns the current system encoding. 
The system encoding is used whenever Tcl passes strings to system calls.

@kkato233 kkato233 force-pushed the fix_filename_encoding_2 branch from c087c4a to e0e51a3 Compare February 20, 2025 16:52
@kkato233
Copy link
Contributor Author

in function parseblobdiffline

git command

git diff-tree -r -p --textconv --submodule -C --cc --no-commit-id -U6 --root $ids

result text ex.

diff --cc あいう.txt
index ac63e4b,33b5521..30899db
--- a/あいう.txt
+++ b/あいう.txt
@@@ -1,2 -1,2 +1,3 @@@
  あいう
 +456
+ 123

Fixed an issue with retrieving file names.

@kkato233
Copy link
Contributor Author

example code

git checkout -b master
echo "あいう" > あいう.txt
git add *
git commit -m "add あいう"

git checkout -b A
echo "123" >> あいう.txt
git add *
git commit -m "add 123"

git checkout -b B master
echo "456" >> あいう.txt
git add *
git commit -m "add 456"

git merge A
... fix conflict ...

gitk

image

fix in
image

@kkato233
Copy link
Contributor Author

git add *
git commit -m "fix comflict"

gitk

image

fix it
image

@kkato233
Copy link
Contributor Author

gitk あいう.txt

あいう.txt file not found

image

fix it

image

Based on the information from https://www.tcl.tk/man/tcl/TclCmd/encoding.htm

encoding system ?encoding?
Set the system encoding to encoding. 
If encoding is omitted then the command returns the current system encoding. 
The system encoding is used whenever Tcl passes strings to system calls.

This ensures that command line parameters passed when calling Git commands are treated as UTF-8 instead of SJIS (or ANSI) .

after fix it

image

@kkato233
Copy link
Contributor Author

@j6t @avih

I reviewed the changes in the pull request at #7

@kkato233
Copy link
Contributor Author

see git file name encoding UTF-8 documents.

https://git-scm.com/docs/git-commit/2.13.7#_discussion

@j6t
Copy link
Owner

j6t commented Feb 20, 2025

Please let's continue in #7. Please participate in the conversation there.

I see you insist in encoding system utf-8, but you did not provide an explanation why it is needed.

It is unclear what you want to tell us with the reference to the git-commit manual page.

@j6t j6t closed this Feb 20, 2025
@kkato233 kkato233 deleted the fix_filename_encoding_2 branch March 20, 2025 04:53
@kkato233 kkato233 restored the fix_filename_encoding_2 branch March 20, 2025 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants