Cleanup libgit init calls
This commit is contained in:
parent
ba5ad70b68
commit
8a306eecb6
|
@ -56,7 +56,8 @@ DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository*
|
||||||
m_tempRepo = true;
|
m_tempRepo = true;
|
||||||
m_tempPath = wxFileName::CreateTempFileName( "kicadtestrepo" );
|
m_tempPath = wxFileName::CreateTempFileName( "kicadtestrepo" );
|
||||||
|
|
||||||
git_repository_init_options options = GIT_REPOSITORY_INIT_OPTIONS_INIT;
|
git_repository_init_options options;
|
||||||
|
git_repository_init_init_options( &options, GIT_REPOSITORY_INIT_OPTIONS_VERSION );
|
||||||
options.flags = GIT_REPOSITORY_INIT_MKPATH | GIT_REPOSITORY_INIT_NO_REINIT;
|
options.flags = GIT_REPOSITORY_INIT_MKPATH | GIT_REPOSITORY_INIT_NO_REINIT;
|
||||||
git_repository_init_ext( &m_repository, m_tempPath.ToStdString().c_str(), &options );
|
git_repository_init_ext( &m_repository, m_tempPath.ToStdString().c_str(), &options );
|
||||||
}
|
}
|
||||||
|
@ -260,7 +261,8 @@ void DIALOG_GIT_REPOSITORY::updateURLData()
|
||||||
void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event )
|
void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
git_remote* remote = nullptr;
|
git_remote* remote = nullptr;
|
||||||
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
git_remote_callbacks callbacks;
|
||||||
|
git_remote_init_callbacks( &callbacks, GIT_REMOTE_CALLBACKS_VERSION );
|
||||||
|
|
||||||
// We track if we have already tried to connect.
|
// We track if we have already tried to connect.
|
||||||
// If we have, the server may come back to offer another connection
|
// If we have, the server may come back to offer another connection
|
||||||
|
|
|
@ -121,8 +121,6 @@ private:
|
||||||
|
|
||||||
bool m_tempRepo;
|
bool m_tempRepo;
|
||||||
wxString m_tempPath;
|
wxString m_tempPath;
|
||||||
|
|
||||||
KIGIT_COMMON::GIT_CONN_TYPE m_repoType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DIALOG_GIT_REPOSITORY_H_ */
|
#endif /* DIALOG_GIT_REPOSITORY_H_ */
|
|
@ -51,7 +51,8 @@ bool GIT_CLONE_HANDLER::PerformClone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT;
|
git_clone_options cloneOptions;
|
||||||
|
git_clone_init_options( &cloneOptions, GIT_CLONE_OPTIONS_VERSION );
|
||||||
cloneOptions.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
|
cloneOptions.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
|
||||||
cloneOptions.checkout_opts.progress_cb = clone_progress_cb;
|
cloneOptions.checkout_opts.progress_cb = clone_progress_cb;
|
||||||
cloneOptions.checkout_opts.progress_payload = this;
|
cloneOptions.checkout_opts.progress_payload = this;
|
||||||
|
|
|
@ -47,7 +47,8 @@ bool GIT_PULL_HANDLER::PerformFetch()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_remote_callbacks remoteCallbacks = GIT_REMOTE_CALLBACKS_INIT;
|
git_remote_callbacks remoteCallbacks;
|
||||||
|
git_remote_init_callbacks( &remoteCallbacks, GIT_REMOTE_CALLBACKS_VERSION );
|
||||||
remoteCallbacks.sideband_progress = progress_cb;
|
remoteCallbacks.sideband_progress = progress_cb;
|
||||||
remoteCallbacks.transfer_progress = transfer_progress_cb;
|
remoteCallbacks.transfer_progress = transfer_progress_cb;
|
||||||
remoteCallbacks.credentials = credentials_cb;
|
remoteCallbacks.credentials = credentials_cb;
|
||||||
|
@ -60,7 +61,8 @@ bool GIT_PULL_HANDLER::PerformFetch()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_fetch_options fetchOptions = GIT_FETCH_OPTIONS_INIT;
|
git_fetch_options fetchOptions;
|
||||||
|
git_fetch_init_options( &fetchOptions, GIT_FETCH_OPTIONS_VERSION );
|
||||||
fetchOptions.callbacks = remoteCallbacks;
|
fetchOptions.callbacks = remoteCallbacks;
|
||||||
|
|
||||||
if( git_remote_fetch( remote, nullptr, &fetchOptions, nullptr ) )
|
if( git_remote_fetch( remote, nullptr, &fetchOptions, nullptr ) )
|
||||||
|
@ -188,7 +190,8 @@ PullResult GIT_PULL_HANDLER::handleFastForward()
|
||||||
return PullResult::Error;
|
return PullResult::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_checkout_options checkoutOptions = GIT_CHECKOUT_OPTIONS_INIT;
|
git_checkout_options checkoutOptions;
|
||||||
|
git_checkout_init_options( &checkoutOptions, GIT_CHECKOUT_OPTIONS_VERSION );
|
||||||
checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE;
|
checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE;
|
||||||
if( git_checkout_head( m_repo, &checkoutOptions ) )
|
if( git_checkout_head( m_repo, &checkoutOptions ) )
|
||||||
{
|
{
|
||||||
|
@ -239,8 +242,11 @@ PullResult GIT_PULL_HANDLER::handleFastForward()
|
||||||
PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHeads,
|
PullResult GIT_PULL_HANDLER::handleMerge( const git_annotated_commit** aMergeHeads,
|
||||||
size_t aMergeHeadsCount )
|
size_t aMergeHeadsCount )
|
||||||
{
|
{
|
||||||
git_merge_options merge_opts = GIT_MERGE_OPTIONS_INIT;
|
git_merge_options merge_opts;
|
||||||
git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
|
git_merge_options_init( &merge_opts, GIT_MERGE_OPTIONS_VERSION );
|
||||||
|
|
||||||
|
git_checkout_options checkout_opts;
|
||||||
|
git_checkout_init_options( &checkout_opts, GIT_CHECKOUT_OPTIONS_VERSION );
|
||||||
|
|
||||||
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
|
checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ PushResult GIT_PUSH_HANDLER::PerformPush()
|
||||||
return PushResult::Error;
|
return PushResult::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_remote_callbacks remoteCallbacks = GIT_REMOTE_CALLBACKS_INIT;
|
git_remote_callbacks remoteCallbacks;
|
||||||
|
git_remote_init_callbacks( &remoteCallbacks, GIT_REMOTE_CALLBACKS_VERSION );
|
||||||
remoteCallbacks.sideband_progress = progress_cb;
|
remoteCallbacks.sideband_progress = progress_cb;
|
||||||
remoteCallbacks.transfer_progress = transfer_progress_cb;
|
remoteCallbacks.transfer_progress = transfer_progress_cb;
|
||||||
remoteCallbacks.update_tips = update_cb;
|
remoteCallbacks.update_tips = update_cb;
|
||||||
|
@ -59,7 +60,8 @@ PushResult GIT_PUSH_HANDLER::PerformPush()
|
||||||
return PushResult::Error;
|
return PushResult::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_push_options pushOptions = GIT_PUSH_OPTIONS_INIT;
|
git_push_options pushOptions;
|
||||||
|
git_push_init_options( &pushOptions, GIT_PUSH_OPTIONS_VERSION );
|
||||||
pushOptions.callbacks = remoteCallbacks;
|
pushOptions.callbacks = remoteCallbacks;
|
||||||
|
|
||||||
if( git_remote_push( remote, nullptr, &pushOptions ) )
|
if( git_remote_push( remote, nullptr, &pushOptions ) )
|
||||||
|
|
|
@ -63,7 +63,8 @@ static int checkout_notify_cb(git_checkout_notify_t why, const char *path,
|
||||||
void GIT_REVERT_HANDLER::PerformRevert()
|
void GIT_REVERT_HANDLER::PerformRevert()
|
||||||
{
|
{
|
||||||
git_object* head_commit = NULL;
|
git_object* head_commit = NULL;
|
||||||
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
|
git_checkout_options opts;
|
||||||
|
git_checkout_init_options(&opts, GIT_CHECKOUT_OPTIONS_VERSION);
|
||||||
|
|
||||||
// Get the HEAD commit
|
// Get the HEAD commit
|
||||||
if (git_revparse_single(&head_commit, m_repository, "HEAD") != 0) {
|
if (git_revparse_single(&head_commit, m_repository, "HEAD") != 0) {
|
||||||
|
|
|
@ -252,7 +252,8 @@ std::pair<std::set<wxString>,std::set<wxString>> KIGIT_COMMON::GetDifferentFiles
|
||||||
|
|
||||||
|
|
||||||
git_diff* diff;
|
git_diff* diff;
|
||||||
git_diff_options diff_opts = GIT_DIFF_OPTIONS_INIT;
|
git_diff_options diff_opts;
|
||||||
|
git_diff_init_options( &diff_opts, GIT_DIFF_OPTIONS_VERSION );
|
||||||
|
|
||||||
if( git_diff_tree_to_tree( &diff, m_repo, parent_tree, tree, &diff_opts ) == GIT_OK )
|
if( git_diff_tree_to_tree( &diff, m_repo, parent_tree, tree, &diff_opts ) == GIT_OK )
|
||||||
{
|
{
|
||||||
|
|
|
@ -712,7 +712,8 @@ bool PROJECT_TREE_PANE::hasChangedFiles()
|
||||||
if( !repo )
|
if( !repo )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
git_status_options opts = GIT_STATUS_OPTIONS_INIT;
|
git_status_options opts;
|
||||||
|
git_status_init_options( &opts, GIT_STATUS_OPTIONS_VERSION );
|
||||||
|
|
||||||
opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
||||||
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX
|
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX
|
||||||
|
@ -1947,7 +1948,8 @@ void PROJECT_TREE_PANE::updateGitStatusIcons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
git_status_options status_options = GIT_STATUS_OPTIONS_INIT;
|
git_status_options status_options;
|
||||||
|
git_status_init_options( &status_options, GIT_STATUS_OPTIONS_VERSION );
|
||||||
status_options.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
status_options.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
||||||
status_options.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_INCLUDE_UNMODIFIED;
|
status_options.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_INCLUDE_UNMODIFIED;
|
||||||
|
|
||||||
|
@ -2097,7 +2099,8 @@ void PROJECT_TREE_PANE::onGitCommit( wxCommandEvent& aEvent )
|
||||||
git_config_free( config );
|
git_config_free( config );
|
||||||
|
|
||||||
// Collect modified files in the repository
|
// Collect modified files in the repository
|
||||||
git_status_options status_options = GIT_STATUS_OPTIONS_INIT;
|
git_status_options status_options;
|
||||||
|
git_status_init_options( &status_options, GIT_STATUS_OPTIONS_VERSION );
|
||||||
status_options.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
status_options.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
||||||
status_options.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED;
|
status_options.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue