Class GitWrapper

Class Documentation

class GitWrapper

Thin wrapper around libgit2 for common operations.

Public Functions

bool add(const fs::path &path)

Add a file to the repository index.

bool open(const fs::path &path)

Open an existing repository.

DiffResult diff(const gitwrap::commit &oldCommit, const gitwrap::commit &newCommit)

Get a diff between two commits.

MAYBE_BLAME Blame(const fs::path &filepath, const gitwrap::commit &newCommit, const gitwrap::commit &oldCommit)

Run git blame on a file between two commits.

bool commit(git_signature *sign, const std::string &message)

Commit staged changes using the provided signature.

bool log()
bool log(const std::string &branchName)
bool close()

Close the repository and free resources.

GitWrapper()

Construct an empty wrapper.

~GitWrapper()

Destructor.

Public Members

git_repository *repo = nullptr
std::optional<gitwrap::logHandle> log_hdl
BRANCH_HANDLE handleBranch

Public Static Functions

static std::string GenTimeStamp()