Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Operations: transform CloneOperation back to simple static method #75

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions libGitWrap/Repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,30 @@ namespace Git
* @brief Represents a Git repository.
*/

/**
* @brief Clone a Git repository.
*
* @param[in,out] result A Result object; see @ref GitWrapErrorHandling
*
* @param[in] from the URL to clone from
*
* @param[in] to the path to clone to
*
* @return the cloned repository
*/
Repository Repository::clone(Result& result, const QString& from, const QString& to)
{
GW_CHECK_RESULT(result, nullptr);

// TODO: setup clone options and callbacks

git_repository* clonedRepo = nullptr;
result = git_clone(&clonedRepo, GW_StringFromQt(from), GW_StringFromQt(to), nullptr /*TODO: clone options*/);
GW_CHECK_RESULT(result, nullptr);

return new Private(clonedRepo);
}

/**
* @brief Create a new repository
*
Expand Down
5 changes: 5 additions & 0 deletions libGitWrap/Repository.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ namespace Git
GW_PRIVATE_DECL(Repository, Base, public)

public:
static Repository clone(Result& result,
const QString& from,
const QString& to
/*TODO: options*/);

static Repository create(Result& result,
const QString& path,
bool bare);
Expand Down