@@ -63,10 +63,10 @@ bool GitPlugin::check_errors(int error, godot::String function, godot::String fi
6363 message = message + " ." ;
6464 if ((lg2err = git_error_last ()) != nullptr && lg2err->message != nullptr ) {
6565 message = message + " Error " + godot::String::num_int64 (error) + " : " ;
66- message = message + godot::String (lg2err->message );
66+ message = message + godot::String::utf8 (lg2err->message );
6767 }
6868
69- godot::UtilityFunctions::push_error (" GitPlugin: " , CString ( message). data , " in " , CString ( file). data , " :" , CString ( function). data , " #L" , line);
69+ godot::UtilityFunctions::push_error (" GitPlugin: " , message, " in " , file, " :" , function, " #L" , line);
7070 return true ;
7171}
7272
@@ -232,9 +232,9 @@ godot::TypedArray<godot::Dictionary> GitPlugin::_get_modified_files_data() {
232232 const git_status_entry *entry = git_status_byindex (statuses.get (), i);
233233 godot::String path;
234234 if (entry->index_to_workdir ) {
235- path = entry->index_to_workdir ->new_file .path ;
235+ path = godot::String::utf8 ( entry->index_to_workdir ->new_file .path ) ;
236236 } else {
237- path = entry->head_to_index ->new_file .path ;
237+ path = godot::String::utf8 ( entry->head_to_index ->new_file .path ) ;
238238 }
239239
240240 const static int git_status_wt = GIT_STATUS_WT_NEW | GIT_STATUS_WT_MODIFIED | GIT_STATUS_WT_DELETED | GIT_STATUS_WT_TYPECHANGE | GIT_STATUS_WT_RENAMED | GIT_STATUS_CONFLICTED;
@@ -246,7 +246,7 @@ godot::TypedArray<godot::Dictionary> GitPlugin::_get_modified_files_data() {
246246
247247 if (entry->status & git_status_index) {
248248 if (entry->status & GIT_STATUS_INDEX_RENAMED) {
249- godot::String old_path = entry->head_to_index ->old_file .path ;
249+ godot::String old_path = godot::String::utf8 ( entry->head_to_index ->old_file .path ) ;
250250 stats_files.push_back (create_status_file (old_path, map_changes.at (GIT_STATUS_INDEX_DELETED), TREE_AREA_STAGED));
251251 stats_files.push_back (create_status_file (path, map_changes.at (GIT_STATUS_INDEX_NEW), TREE_AREA_STAGED));
252252 } else {
@@ -273,9 +273,9 @@ godot::TypedArray<godot::String> GitPlugin::_get_branch_list() {
273273
274274 if (git_branch_is_head (ref.get ())) {
275275 // Always send the current branch as the first branch in list
276- branch_names.push_front (name);
276+ branch_names.push_front (godot::String::utf8 ( name) );
277277 } else {
278- branch_names.push_back (godot::String (name));
278+ branch_names.push_back (godot::String::utf8 (name));
279279 }
280280 }
281281
@@ -352,7 +352,7 @@ godot::String GitPlugin::_get_current_branch_name() {
352352 const char *name = " " ;
353353 GIT2_CALL_R (git_branch_name (&name, branch.get ()), " Could not get branch name from current branch reference" , " " );
354354
355- return name;
355+ return godot::String::utf8 ( name) ;
356356}
357357
358358godot::TypedArray<godot::String> GitPlugin::_get_remotes () {
@@ -361,7 +361,7 @@ godot::TypedArray<godot::String> GitPlugin::_get_remotes() {
361361
362362 godot::TypedArray<godot::String> remotes;
363363 for (int i = 0 ; i < remote_array.count ; i++) {
364- remotes.push_back (remote_array.strings [i]);
364+ remotes.push_back (godot::String::utf8 ( remote_array.strings [i]) );
365365 }
366366
367367 return remotes;
@@ -382,10 +382,10 @@ godot::TypedArray<godot::Dictionary> GitPlugin::_get_previous_commits(int32_t ma
382382 GIT2_CALL_R (git_commit_lookup (Capture (commit), repo.get (), &oid), " Failed to lookup the commit" , commits);
383383
384384 git_oid_tostr (commit_id, GIT_OID_HEXSZ + 1 , git_commit_id (commit.get ()));
385- godot::String msg = git_commit_message (commit.get ());
385+ godot::String msg = godot::String::utf8 ( git_commit_message (commit.get () ));
386386
387387 const git_signature *sig = git_commit_author (commit.get ());
388- godot::String author = godot::String () + sig->name + " <" + sig->email + " >" ;
388+ godot::String author = godot::String::utf8 ( sig->name ) + " <" + godot::String::utf8 ( sig->email ) + " >" ;
389389
390390 commits.push_back (create_commit (msg, author, commit_id, sig->when .time , sig->when .offset ));
391391 }
@@ -394,7 +394,7 @@ godot::TypedArray<godot::Dictionary> GitPlugin::_get_previous_commits(int32_t ma
394394}
395395
396396void GitPlugin::_fetch (const godot::String &remote) {
397- godot::UtilityFunctions::print (" GitPlugin: Performing fetch from " , CString ( remote). data );
397+ godot::UtilityFunctions::print (" GitPlugin: Performing fetch from " , remote);
398398
399399 git_remote_ptr remote_object;
400400 GIT2_CALL (git_remote_lookup (Capture (remote_object), repo.get (), CString (remote).data ), " Could not lookup remote \" " + remote + " \" " );
@@ -418,7 +418,7 @@ void GitPlugin::_fetch(const godot::String &remote) {
418418}
419419
420420void GitPlugin::_pull (const godot::String &remote) {
421- godot::UtilityFunctions::print (" GitPlugin: Performing pull from " , CString ( remote). data );
421+ godot::UtilityFunctions::print (" GitPlugin: Performing pull from " , remote);
422422
423423 git_remote_ptr remote_object;
424424 GIT2_CALL (git_remote_lookup (Capture (remote_object), repo.get (), CString (remote).data ), " Could not lookup remote \" " + remote + " \" " );
@@ -515,7 +515,7 @@ void GitPlugin::_pull(const godot::String &remote) {
515515}
516516
517517void GitPlugin::_push (const godot::String &remote, bool force) {
518- godot::UtilityFunctions::print (" GitPlugin: Performing push to " , CString ( remote). data );
518+ godot::UtilityFunctions::print (" GitPlugin: Performing push to " , remote);
519519
520520 git_remote_ptr remote_object;
521521 GIT2_CALL (git_remote_lookup (Capture (remote_object), repo.get (), CString (remote).data ), " Could not lookup remote \" " + remote + " \" " );
@@ -529,7 +529,8 @@ void GitPlugin::_push(const godot::String &remote, bool force) {
529529 remote_cbs.push_transfer_progress = &push_transfer_progress_cb;
530530 remote_cbs.push_update_reference = &push_update_reference_cb;
531531
532- GIT2_CALL (git_remote_connect (remote_object.get (), GIT_DIRECTION_PUSH, &remote_cbs, nullptr , nullptr ), " Could not connect to remote \" " + remote + " \" . Are your credentials correct? Try using a PAT token (in case you are using Github) as your password" );
532+ godot::String msg = " Could not connect to remote \" " + remote + " \" . Are your credentials correct? Try using a PAT token (in case you are using Github) as your password" ;
533+ GIT2_CALL (git_remote_connect (remote_object.get (), GIT_DIRECTION_PUSH, &remote_cbs, nullptr , nullptr ), msg);
533534
534535 godot::String branch_name = _get_current_branch_name ();
535536
@@ -629,7 +630,7 @@ godot::TypedArray<godot::Dictionary> GitPlugin::_parse_diff(git_diff *diff) {
629630 git_patch_ptr patch;
630631 GIT2_CALL_R (git_patch_from_diff (Capture (patch), diff, i), " Could not create patch from diff" , godot::TypedArray<godot::Dictionary>());
631632
632- godot::Dictionary diff_file = create_diff_file (delta->new_file .path , delta->old_file .path );
633+ godot::Dictionary diff_file = create_diff_file (godot::String::utf8 ( delta->new_file .path ), godot::String::utf8 ( delta->old_file .path ) );
633634
634635 godot::TypedArray<godot::Dictionary> diff_hunks;
635636 for (int j = 0 ; j < git_patch_num_hunks (patch.get ()); j++) {
@@ -650,7 +651,7 @@ godot::TypedArray<godot::Dictionary> GitPlugin::_parse_diff(git_diff *diff) {
650651
651652 godot::String status = " " ; // We reserve 1 null terminated space to fill the + or the - character at git_diff_line->origin
652653 status[0 ] = git_diff_line->origin ;
653- diff_lines.push_back (create_diff_line (git_diff_line->new_lineno , git_diff_line->old_lineno , godot::String (content), status));
654+ diff_lines.push_back (create_diff_line (git_diff_line->new_lineno , git_diff_line->old_lineno , godot::String::utf8 (content), status));
654655
655656 delete[] content;
656657 }
@@ -680,17 +681,17 @@ bool GitPlugin::_initialize(const godot::String &project_path) {
680681
681682 git_buf discovered_repo_path = {};
682683 if (git_repository_discover (&discovered_repo_path, CString (project_path).data , 1 , nullptr ) == 0 ) {
683- repo_project_path = godot::String (discovered_repo_path.ptr );
684+ repo_project_path = godot::String::utf8 (discovered_repo_path.ptr );
684685
685- godot::UtilityFunctions::print (" Found a repository at " + godot::String (discovered_repo_path. ptr ) + " ." );
686+ godot::UtilityFunctions::print (" Found a repository at " + repo_project_path + " ." );
686687 git_buf_dispose (&discovered_repo_path);
687688 } else {
688689 repo_project_path = project_path;
689690
690691 godot::UtilityFunctions::push_warning (" Could not find any higher level repositories." );
691692 }
692693
693- godot::UtilityFunctions::print (" Selected repository path: " + godot::String ( repo_project_path) + " ." );
694+ godot::UtilityFunctions::print (" Selected repository path: " + repo_project_path + " ." );
694695 GIT2_CALL_R (git_repository_init (Capture (repo), CString (repo_project_path).data , 0 ), " Could not initialize repository" , false );
695696
696697 git_reference_ptr head;
0 commit comments