LGitSignature: Answer #name and #email using #readStringUTF8 instead… #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is how my global user.name is read on my MacOS, and I think it can be generalizable to others.
For example, if in terminal I set my name with tildes:
In Pharo, I evaluate:
and obtain
'MartÃn Dias'
in both cases.The solution I propose in this PR
The method
readString
is an extension of UnifiedFFI package, but there this alsoreadStringUTF8
which reads the name and email correctly. I created a test that emulates my problem and it's fixed.Comments
First. I could convert the name and email with from the utf8 encoding only when reading the
LGitRepository>>defaultSignature
.Second. Didn't dig why, but if (in the test) I create the signature with
LGitSignature name: 'Martín Dias' email: '...'
the, there is no problem. That's why I emulate my problem creating the signature withLGitSignature name: 'Martín Dias' utf8Encoded asString email: '...'
.Third. Apparently, another option to create the test scenario is to update the
.git/config
file of a test repository to add the following lines:Fouth. I checked with
flie -I ~/.gitconfig
that git stores the global user.name with a uft8 encoding.Fifth. I was working in a recent Pharo 9, and verified that
LGitLibrary uniqueInstance version
is#(1 0 0)
.