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

Updates for issue #150 to use UTF8 instead of String when dealing with data from the git repository #229

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

markeel
Copy link
Contributor

@markeel markeel commented Apr 1, 2024

Re-implemented the original update for UTF-8 based on latest master, for a clean merge.

Replaced the places where the libgit2 API used godot::String with godot::String::utf8

Tested using emojis as place holders for language specific Unicode characters

  • in file names and directory names.
  • renames of files
  • commit messages

…ealing

with data from the git repository
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (I haven't tested it though).

@markeel
Copy link
Contributor Author

markeel commented Apr 1, 2024

Great, what does it take to release it into the asset library?

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following places probably should have UTF-8 conversion as well:

Old path:

godot::String old_path = entry->head_to_index->old_file.path;

Both "name" here:

branch_names.push_front(name);
} else {
branch_names.push_back(godot::String(name));

"name" here:

godot::String author = godot::String() + sig->name + " <" + sig->email + ">";

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And few more:

Return value:

Remotes:

remotes.push_back(remote_array.strings[i]);

Bunch of godot::String(...) uses in git_callbacks.cpp

Username:

godot::String proper_username = username_from_url ? username_from_url : creds->username;

@Calinou
Copy link
Member

Calinou commented Apr 3, 2024

@markeel Can you make the requested changes? I'll merge this afterwards.

@markeel
Copy link
Contributor Author

markeel commented Apr 3, 2024 via email

@markeel
Copy link
Contributor Author

markeel commented Apr 4, 2024

I incorporated the items @bruvzg identified in his review. Those were subtle impacts. The only change I didn't apply was the one in git_callbacks related to username. The trickiness with this fix, is whether the string was already a "godot" string. In the case of the username it was coming from credentials and therefore was a "godot" string. When it comes from the URL the string cannot be UTF-8 since those are invalid characters in a URL.

During testing (where I created repositories and branch names with emojis in the name) I ran into problems where the messages being logged to the "Output" window using the UtilityFunction::print(...) methods needed to be updated. Many of the calls were converting from a "godot" string back to a CString, but then the print function would convert it back to a "godot" string but not convert the C string as a UTF-8. Since the print() method takes godot string it was more accurate and effective to remove this extraneous conversion to CString.

I also tested error legs, by shutting down the server running my remote repositories to see how pull and push reported errors.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Calinou Calinou merged commit d6582fa into godotengine:master Apr 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot show Chinese correctly
3 participants