|
|
bool | checkout (const std::string &branch) const noexcept |
| | Checkout a branch.
|
| |
|
bool | checkout (const Reference &reference) const noexcept |
| | Checkout a Reference reference.
|
| |
|
bool | checkoutTree (const Tree &tree, unsigned int strategy=GIT_CHECKOUT_SAFE) const noexcept |
| | Update index and files to match tree.
|
| |
| std::optional< std::string > | catFile (const std::string &branch, const std::string &file) const noexcept |
| | Cat a file in a branch. More...
|
| |
|
std::variant< Blob, Commit, Tag, Tree, std::monostate > | revparseSingle (const std::string &rev) const noexcept |
| | Parse rev as either blob, commit, tag, or tree.
|
| |
|
std::optional< Blob > | blobCreateFromWorkDir (const std::filesystem::path &file) const noexcept |
| | Create a new Blob from file in workdir.
|
| |
|
std::optional< Blob > | blobCreateFromDisk (const std::filesystem::path &file) const noexcept |
| | Create a new Blob from file.
|
| |
|
std::optional< Blob > | blobCreateFromBuffer (const std::string &buf) const noexcept |
| | Create a new Blob from string buf.
|
| |
|
std::optional< Blob > | blobLookup (const git_oid &oid) const noexcept |
| | Get a Blob corresponding to oid.
|
| |
|
std::optional< Blob > | blobLookup (const TreeEntry &tentry) const noexcept |
| | Get a Blob corresponding to tentry.
|
| |
|
std::optional< Blob > | blobRevparseSingle (const std::string &rev) const noexcept |
| | Parse rev as blob.
|
| |
|
std::optional< Commit > | commitLookup (const git_oid &oid) const noexcept |
| | Get a Commit corresponding to oid.
|
| |
|
std::optional< Commit > | commitCreate (const Signature &author, const Signature &committer, const std::string &msg, const Tree &tree, const std::vector< const Commit *> &parents={}) const noexcept |
| | Create a new Commit.
|
| |
|
std::optional< Commit > | commitCreateCheckout (const Signature &author, const Signature &committer, const std::string &msg, const Tree &tree, unsigned int strategy=GIT_CHECKOUT_SAFE, const std::vector< const Commit *> &parents={}) const noexcept |
| | Create a new Commit and move to it.
|
| |
|
std::optional< Commit > | commitHead () const noexcept |
| | Get a Commit corresponding to HEAD.
|
| |
|
std::optional< Commit > | commitRevparseSingle (const std::string &rev) const noexcept |
| | Parse rev as commit.
|
| |
| std::optional< Diff > | diff (const Commit &commit1, const Commit &commit2, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of commit1 and commit2. More...
|
| |
| std::optional< Diff > | diff (const Tree &tree1, const Tree &tree2, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of tree1 and tree2. More...
|
| |
| std::optional< Diff > | diffCached (const Commit &commit, const Index &index, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of a commit and index. More...
|
| |
| std::optional< Diff > | diffCached (const Tree &tree, const Index &index, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of a tree and index. More...
|
| |
|
std::optional< Diff > | diffCached (const Commit &commit, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of a commit and repo's index.
|
| |
|
std::optional< Diff > | diffCached (const Tree &tree, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of a tree and repo's index.
|
| |
| std::optional< Diff > | diffWorkdir (const Index &index, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of an index and workdir. More...
|
| |
|
std::optional< Diff > | diffWorkdir (const Commit &commit, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of a commit and workdir.
|
| |
|
std::optional< Diff > | diffWorkdir (const Tree &tree, const git_diff_options *opts=nullptr) const noexcept |
| | Create a new Diff of a tree and workdir.
|
| |
|
std::optional< Index > | index () const noexcept |
| | Get repository's index.
|
| |
|
std::optional< Remote > | remoteCreate (const std::string &name, const std::string &url) const noexcept |
| | Create a new Remote called name located at url.
|
| |
|
std::optional< Remote > | remoteLookup (const std::string &name) const noexcept |
| | Get a Remote called name.
|
| |
|
std::optional< Reference > | refLookup (const std::string &name) const noexcept |
| | Get a Reference called exactly name (like refs/heads/master)
|
| |
|
std::optional< Reference > | refDWIM (const std::string &name) const noexcept |
| | Get a Reference called name (like master)
|
| |
|
std::optional< Reference > | refCreateDirect (const std::string &name, const git_oid &oid, bool force=false) const noexcept |
| | Create a new direct Reference to oid called name.
|
| |
|
std::optional< Reference > | refCreateSymbolic (const std::string &name, const std::string &target, bool force=false) const noexcept |
| | Create a new symbolic Reference to target called name.
|
| |
|
std::optional< RevWalk > | revWalkCreate () const noexcept |
| | Create a new RevWalk.
|
| |
|
std::optional< Tag > | tagCreate (const std::string &tagName, const Object &target, const Signature &tagger, const std::string &message, bool force=false) const noexcept |
| | Create a new Tag called tagName, pointing at target.
|
| |
|
std::optional< Tag > | tagLookup (const git_oid &oid) const noexcept |
| | Get a Tag corresponding to oid.
|
| |
|
std::optional< Tag > | tagLookup (const TreeEntry &tentry) const noexcept |
| | Get a Tag corresponding to tentry.
|
| |
|
std::optional< Tag > | tagRevparseSingle (const std::string &rev) const noexcept |
| | Parse rev as tag.
|
| |
|
std::optional< Tree > | treeLookup (const git_oid &oid) const noexcept |
| | Get a Tree corresponding to oid.
|
| |
|
std::optional< Tree > | treeLookup (const TreeEntry &tentry) const noexcept |
| | Get a Tree corresponding to tentry.
|
| |
|
std::optional< Tree > | treeRevparseSingle (const std::string &rev) const noexcept |
| | Parse rev as tree.
|
| |
|
std::optional< TreeBuilder > | treeBuilderCreate (const Tree *source=nullptr) const noexcept |
| | Create a new TreeBuilder.
|
| |
|
std::filesystem::path | path () const noexcept |
| | Get the path to .git.
|
| |
|
std::filesystem::path | workDir () const noexcept |
| | Get the path to sources.
|
| |
|
GitTy * | repo () const noexcept |
| | Get the underlying libgit2 pointer.
|
| |
|
| operator GitTy * () const noexcept |
| | Get the underlying libgit2 pointer.
|
| |
|
| static std::optional< Repo > | init (const std::filesystem::path &path, bool bare=false, const std::string &originUrl="") noexcept |
| | init Init an empty repository More...
|
| |
| static std::optional< Repo > | clone (const std::filesystem::path &path, const std::string &url, FetchCallbacks &fc, const std::string &branch="", const unsigned int &depth=0, bool tags=true) noexcept |
| | clone Clone (and open) an existing repository More...
|
| |
| static std::optional< Repo > | clone (const std::filesystem::path &path, const std::string &url, const std::string &branch="", const unsigned int &depth=0, bool tags=true) noexcept |
| | clone Clone (and open) an existing repository More...
|
| |
| static std::optional< Repo > | open (const std::filesystem::path &path=".") noexcept |
| | Open an existing repository. More...
|
| |
| static bool | update (const std::filesystem::path &path, const std::string &remote="origin") |
| | Update/fetch remote remote in repository at path. More...
|
| |
|
static auto & | lastError () noexcept |
| | Return the last error string if some (from git_last_error())
|
| |
|
static auto | lastClass () noexcept |
| | Return the last error class (from git_last_error())
|
| |
|
static auto | lastErrno () noexcept |
| | Return the last error number (returned from git_* functions)
|
| |
The most important Git class.
It is the starting point to work with a git repository using this library.
repo->remoteCreate(
"origin",
"ssh://some_host/repo");
auto repo2 =
Repo::clone(
"git",
"https://github.com/git/git");
auto HEAD_SHA = repo2->commitHead()->idStr();