7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 22:13:44 +00:00

Make Git push/pull errors visible

This commit is contained in:
Jon Evans 2024-10-19 12:34:06 -04:00
parent 17e9a55cc8
commit a802ba1199
3 changed files with 16 additions and 7 deletions

View File

@ -43,7 +43,7 @@ bool GIT_PULL_HANDLER::PerformFetch()
if( git_remote_lookup( &remote, m_repo, "origin" ) != 0 )
{
AddErrorString( wxString::Format( _( "Could not lookup remote '%s'" ), "origin" ).ToStdString() );
AddErrorString( wxString::Format( _( "Could not lookup remote '%s'" ), "origin" ) );
return false;
}
@ -57,7 +57,8 @@ bool GIT_PULL_HANDLER::PerformFetch()
if( git_remote_connect( remote, GIT_DIRECTION_FETCH, &remoteCallbacks, nullptr, nullptr ) )
{
git_remote_free( remote );
AddErrorString( wxString::Format( _( "Could not connect to remote '%s'" ), "origin" ).ToStdString() );
AddErrorString( wxString::Format( _( "Could not connect to remote '%s': %s" ), "origin",
git_error_last()->message ) );
return false;
}
@ -68,7 +69,8 @@ bool GIT_PULL_HANDLER::PerformFetch()
if( git_remote_fetch( remote, nullptr, &fetchOptions, nullptr ) )
{
git_remote_free( remote );
AddErrorString( wxString::Format( _( "Could not fetch data from remote '%s'" ), "origin" ) );
AddErrorString( wxString::Format( _( "Could not fetch data from remote '%s': %s" ),
"origin", git_error_last()->message ) );
return false;
}

View File

@ -56,7 +56,8 @@ PushResult GIT_PUSH_HANDLER::PerformPush()
if( git_remote_connect( remote, GIT_DIRECTION_PUSH, &remoteCallbacks, nullptr, nullptr ) )
{
git_remote_free( remote );
AddErrorString( _( "Could not connect to remote" ) );
AddErrorString( wxString::Format( _( "Could not connect to remote: %s" ),
git_error_last()->message ) );
return PushResult::Error;
}
@ -67,7 +68,8 @@ PushResult GIT_PUSH_HANDLER::PerformPush()
if( git_remote_push( remote, nullptr, &pushOptions ) )
{
git_remote_free( remote );
AddErrorString( _( "Could not push to remote" ) );
AddErrorString( wxString::Format( _( "Could not push to remote: %s" ),
git_error_last()->message ) );
return PushResult::Error;
}

View File

@ -1729,7 +1729,12 @@ void PROJECT_TREE_PANE::onGitPullProject( wxCommandEvent& aEvent )
_( "Fetching Remote" ),
1 ) );
handler.PerformPull();
if( handler.PerformPull() != PullResult::Success )
{
wxString errorMessage = handler.GetErrorString();
DisplayErrorMessage( m_parent, _( "Failed to pull project" ), errorMessage );
}
}
@ -2422,4 +2427,4 @@ void PROJECT_TREE_PANE::onGitRemoveFromIndex( wxCommandEvent& aEvent )
void PROJECT_TREE_PANE::onRunSelectedJobsFile(wxCommandEvent& event)
{
}
}