10 #include "../helpers/Unique.h" 19 using GitTy = git_reference;
27 const git_oid *
target() const noexcept {
return git_reference_target(
ref()); }
29 const git_oid *
targetPeel() const noexcept {
return git_reference_target_peel(
ref()); }
31 std::string
symbolicTarget() const noexcept {
return git_reference_symbolic_target(
ref()); }
33 git_reference_t
type() const noexcept {
return git_reference_type(
ref()); }
35 std::string
name() const noexcept {
return git_reference_name(
ref()); }
38 std::optional<Reference>
resolve() const noexcept;
41 GitTy *
ref() const noexcept {
return m_ref.get(); }
43 operator GitTy *()
const noexcept {
return ref(); }
56 using GitTy = git_revwalk;
64 bool push(
const git_oid &oid)
const noexcept {
65 return !Repo::setLastError(git_revwalk_push(
revWalk(), &oid));
68 bool push(
const std::string &
id)
const noexcept;
71 return !Repo::setLastError(git_revwalk_push_head(
revWalk()));
74 bool pushRef(
const std::string &ref)
const noexcept {
75 return !Repo::setLastError(git_revwalk_push_ref(
revWalk(), ref.c_str()));
78 bool pushGlob(
const std::string &glob)
const noexcept {
79 return !Repo::setLastError(git_revwalk_push_glob(
revWalk(), glob.c_str()));
82 bool pushRange(
const std::string &range)
const noexcept {
83 return !Repo::setLastError(git_revwalk_push_range(
revWalk(), range.c_str()));
87 bool hide(
const git_oid &oid)
const noexcept {
88 return !Repo::setLastError(git_revwalk_hide(
revWalk(), &oid));
91 bool hide(
const std::string &
id)
const noexcept;
93 bool hideGlob(
const std::string &glob)
const noexcept {
94 return !Repo::setLastError(git_revwalk_hide_glob(
revWalk(), glob.c_str()));
98 bool sorting(
unsigned int mode)
const noexcept {
99 return !Repo::setLastError(git_revwalk_sorting(
revWalk(), mode));
103 std::optional<Commit>
next() const noexcept;
106 GitTy *
revWalk() const noexcept {
return m_revWalk.get(); }
108 operator GitTy *()
const noexcept {
return revWalk(); }
111 m_repo(repo), m_revWalk(
revWalk) { }
121 using GitTy = git_signature;
127 static std::optional<Signature>
now(
const std::string &
name,
const std::string &
email);
135 GitTy *
signature() const noexcept {
return m_signature.get(); }
137 operator GitTy *()
const noexcept {
return signature(); }
139 explicit Signature(GitTy *sig) noexcept : m_signature(sig) {}
GitTy * ref() const noexcept
Get the stored pointer to libgit2's git_reference.
Definition: Misc.h:41
const git_oid * target() const noexcept
Get the target of a Reference.
Definition: Misc.h:27
std::optional< Commit > next() const noexcept
Get next Commit in this RevWalk, or nullopt if there are no more.
static std::optional< Signature > now(const std::string &name, const std::string &email)
Create a new Signature with name and email.
GitTy * signature() const noexcept
Get the stored pointer to libgit2's git_signature.
Definition: Misc.h:135
std::string name() const noexcept
Get name of this Reference.
Definition: Misc.h:35
The most important Git class.
Definition: Repo.h:45
GitTy * revWalk() const noexcept
Get the stored pointer to libgit2's git_revwalk.
Definition: Misc.h:106
bool pushHead() const noexcept
Add HEAD to this RevWalk.
Definition: Misc.h:70
bool hideGlob(const std::string &glob) const noexcept
Stop this RevWalk at references matching glob.
Definition: Misc.h:93
bool sorting(unsigned int mode) const noexcept
Set mode as sorting mode (GIT_SORT_NONE, GIT_SORT_TOPOLOGICAL, ...)
Definition: Misc.h:98
bool pushRange(const std::string &range) const noexcept
Add all references matching range (commit1..commit2)
Definition: Misc.h:82
std::string name() const noexcept
Get the name in this Signature.
Definition: Misc.h:130
bool pushGlob(const std::string &glob) const noexcept
Add all references matching glob.
Definition: Misc.h:78
std::string symbolicTarget() const noexcept
Get the target of a symbolic Reference.
Definition: Misc.h:31
std::optional< Reference > resolve() const noexcept
Resolve a symbolic reference to a direct reference.
bool hide(const git_oid &oid) const noexcept
Stop this RevWalk at oid.
Definition: Misc.h:87
std::string email() const noexcept
Get the email in this Signature.
Definition: Misc.h:132
git_reference_t type() const noexcept
Get type of this Reference (GIT_REFERENCE_DIRECT, GIT_REFERENCE_SYMBOLIC)
Definition: Misc.h:33
Reference is a representation of a git reference.
Definition: Misc.h:18
bool pushRef(const std::string &ref) const noexcept
Add a commit referenced by ref to this RevWalk.
Definition: Misc.h:74
const git_oid * targetPeel() const noexcept
Get the peeled target of a Reference.
Definition: Misc.h:29
RevWalk is a representation of a git revwalk.
Definition: Misc.h:55
bool push(const git_oid &oid) const noexcept
Add one OID to this RevWalk.
Definition: Misc.h:64
Signature is a representation of a git signature.
Definition: Misc.h:120