Skip to content
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

LGitSignature: Answer #name and #email using #readStringUTF8 instead… #36

Merged
merged 1 commit into from
Aug 25, 2020

Conversation

tinchodias
Copy link
Collaborator

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:

	$ git config --global user.name 'Martín Dias'

In Pharo, I evaluate:

	aLGitRepository defaultSignature name.
	aLGitRepository defaultSignature prim_name readString.

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 also readStringUTF8 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 with LGitSignature 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:

[user]
	name = Bárt Sïmpsòn

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).

@tinchodias
Copy link
Collaborator Author

I forgot to also comment about the workaround in Iceberg(*) for this problem (I think). The IceLibgitRepository>>commitFromGitCommit: reads the author with thisaLGitCommit author name asByteArray utf8Decoded. If this PR is correct and is merged, then (I think) Iceberg could remove the workaround and additionally also support utf8 emails (don't remember to have seen any, but I guess it's possible).

(*): I'm watching at this version: pharo-vcs/iceberg@8270e50

@tesonep tesonep merged commit d81bf52 into pharo-vcs:master Aug 25, 2020
@tinchodias tinchodias deleted the defaultSignatureUtf8 branch August 26, 2020 14:38
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