Browse Source

Make Git push/pull errors visible

pcb_db
Jon Evans 1 year ago
parent
commit
a802ba1199
  1. 8
      common/git/git_pull_handler.cpp
  2. 6
      common/git/git_push_handler.cpp
  3. 9
      kicad/project_tree_pane.cpp

8
common/git/git_pull_handler.cpp

@ -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;
}

6
common/git/git_push_handler.cpp

@ -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;
}

9
kicad/project_tree_pane.cpp

@ -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)
{
}
}
Loading…
Cancel
Save