31#include <wx/filename.h>
44 std::unique_lock<std::mutex> lock(
GetCommon()->m_gitActionMutex, std::try_to_lock );
46 if( !lock.owns_lock() )
48 wxLogTrace(
traceGit,
"GIT_CLONE_HANDLER::PerformClone() could not lock" );
54 if( !clonePath.DirExists() )
56 if( !clonePath.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
58 AddErrorString( wxString::Format(
_(
"Could not create directory '%s'" ),
64 git_clone_options cloneOptions;
65 git_clone_init_options( &cloneOptions, GIT_CLONE_OPTIONS_VERSION );
66 cloneOptions.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
68 cloneOptions.checkout_opts.progress_payload =
this;
71 cloneOptions.fetch_opts.callbacks.payload =
this;
75 git_repository* newRepo =
nullptr;
78 if( git_clone( &newRepo, remote.mbc_str(),
m_clonePath.mbc_str(),
79 &cloneOptions ) != 0 )
81 AddErrorString( wxString::Format(
_(
"Could not clone repository '%s'" ), remote ) );
GIT_CLONE_HANDLER(KIGIT_COMMON *aCommon)
void UpdateProgress(int aCurrent, int aTotal, const wxString &aMessage) override
void ReportProgress(int aCurrent, int aTotal, const wxString &aMessage)
std::unique_ptr< WX_PROGRESS_REPORTER > m_progressReporter
void SetRepo(git_repository *aRepo)
void AddErrorString(const wxString aErrorString)
unsigned & TestedTypes()
Return the connection types that have been tested for authentication.
KIGIT_COMMON * GetCommon() const
Get the common object.
void ResetNextKey()
Reset the next public key to test.
const wxChar *const traceGit
Flag to enable Git debugging output.
int transfer_progress_cb(const git_transfer_progress *aStats, void *aPayload)
int credentials_cb(git_cred **aOut, const char *aUrl, const char *aUsername, unsigned int aAllowedTypes, void *aPayload)
void clone_progress_cb(const char *aStr, size_t aLen, size_t aTotal, void *aPayload)
wxLogTrace helper definitions.