22 using GitTy = git_commit;
29 std::optional<Commit>
parent(
unsigned int nth = 0)
const noexcept;
31 std::optional<Commit>
ancestor(
unsigned int nth = 0)
const noexcept;
34 std::optional<Tree>
tree()
const noexcept;
37 const git_oid *
treeId() const noexcept {
return git_commit_tree_id(
commit()); }
42 return git_commit_message_encoding(
commit());
45 std::string
message() const noexcept {
return git_commit_message(
commit()); }
47 std::string
summary() const noexcept {
return git_commit_summary(
commit()); }
49 git_time_t
time() const noexcept {
return git_commit_time(
commit()); }
53 const git_signature *
committer() const noexcept {
return git_commit_committer(
commit()); }
55 const git_signature *
author() const noexcept {
return git_commit_author(
commit()); }
57 std::string
rawHeader() const noexcept {
return git_commit_raw_header(
commit()); }
62 const git_oid *
parentId(
unsigned int nth)
const noexcept {
63 return git_commit_parent_id(
commit(), nth);
67 std::optional<std::string>
catFile(
const std::string &file)
const noexcept;
72 operator GitTy *()
const noexcept {
return commit(); }
Git Object class – base for Blob, Commit, Tag, Tree.
Definition: Object.h:65
const git_oid * treeId() const noexcept
Get the OID of the tree of this Commit.
Definition: Commit.h:37
std::optional< Commit > ancestor(unsigned int nth=0) const noexcept
Get the nth generation ancestor of this Commit.
const git_signature * committer() const noexcept
Get the committer of this Commit.
Definition: Commit.h:53
std::optional< Tree > tree() const noexcept
Get the Tree of this Commit.
int timeOffset() const noexcept
Get the timezone offset of this Commit.
Definition: Commit.h:51
GitTy * commit() const noexcept
Get the stored pointer to libgit2's git_commit.
Definition: Commit.h:70
std::string message() const noexcept
Get the commit message of this Commit.
Definition: Commit.h:45
std::string rawHeader() const noexcept
Get a raw Commit header.
Definition: Commit.h:57
static std::string oidToStr(const git_oid &id)
Convert OID id to string.
Definition: Helpers.h:20
The most important Git class.
Definition: Repo.h:45
unsigned int parentCount() const noexcept
Get count of parents.
Definition: Commit.h:60
Commit is a representation of a git commit.
Definition: Commit.h:21
std::optional< Commit > parent(unsigned int nth=0) const noexcept
Get the nth parent of this Commit.
std::string treeIdStr() const noexcept
Get the SHA of the tree of this Commit.
Definition: Commit.h:39
git_time_t time() const noexcept
Get the time of this Commit.
Definition: Commit.h:49
std::optional< std::string > catFile(const std::string &file) const noexcept
Cat a file in this Commit's tree.
const git_oid * parentId(unsigned int nth) const noexcept
Get OID of the nth parent.
Definition: Commit.h:62
std::string summary() const noexcept
Get the summary line of this Commit.
Definition: Commit.h:47
git_commit * typed() const noexcept
Get the stored pointer typed to one of libgit2's types.
Definition: Object.h:83
std::string messageEncoding() const noexcept
Get the commit message encoding of this Commit.
Definition: Commit.h:41
Tag is a representation of a git tag.
Definition: Tag.h:23
const Repo & repo() const
Get the Repo this Object lives in.
Definition: Object.h:38
const git_signature * author() const noexcept
Get the author of this Commit.
Definition: Commit.h:55