40 git_remote* remote =
nullptr;
42 if( git_remote_lookup( &remote,
m_repo,
"origin" ) != 0 )
45 return PushResult::Error;
48 git_remote_callbacks remoteCallbacks;
49 git_remote_init_callbacks( &remoteCallbacks, GIT_REMOTE_CALLBACKS_VERSION );
54 remoteCallbacks.payload =
this;
56 if( git_remote_connect( remote, GIT_DIRECTION_PUSH, &remoteCallbacks,
nullptr,
nullptr ) )
58 git_remote_free( remote );
59 AddErrorString( wxString::Format(
_(
"Could not connect to remote: %s" ),
60 git_error_last()->message ) );
61 return PushResult::Error;
64 git_push_options pushOptions;
65 git_push_init_options( &pushOptions, GIT_PUSH_OPTIONS_VERSION );
66 pushOptions.callbacks = remoteCallbacks;
68 if( git_remote_push( remote,
nullptr, &pushOptions ) )
70 git_remote_free( remote );
72 git_error_last()->message ) );
73 return PushResult::Error;
void ReportProgress(int aCurrent, int aTotal, const wxString &aMessage)
GIT_PUSH_HANDLER(git_repository *aRepo)
void UpdateProgress(int aCurrent, int aTotal, const wxString &aMessage) override
void AddErrorString(const wxString aErrorString)
int update_cb(const char *aRefname, const git_oid *aFirst, const git_oid *aSecond, void *aPayload)
int transfer_progress_cb(const git_transfer_progress *aStats, void *aPayload)
int push_transfer_progress_cb(unsigned int aCurrent, unsigned int aTotal, size_t aBytes, void *aPayload)
int progress_cb(const char *str, int len, void *data)