SlHelpers
Toggle main menu visibility
Loading...
Searching...
No Matches
Tag.h
1
// SPDX-License-Identifier: GPL-2.0-only
2
3
#pragma once
4
5
#include <string>
6
7
#include <git2.h>
8
#include <variant>
9
10
#include "Helpers.h"
11
#include "Object.h"
12
13
namespace
SlGit {
14
15
class
Blob
;
16
class
Commit
;
17
class
Repo
;
18
class
Tree
;
19
23
class
Tag :
public
TypedObject<git_tag> {
24
using
GitTy = git_tag;
25
26
friend
class
Repo;
27
public
:
28
Tag() =
delete
;
29
31
const
git_oid *
targetId
() const noexcept {
return
git_tag_target_id(
tag
()); }
33
std::string
targetIdStr
() const noexcept {
return
Helpers::oidToStr
(*
targetId
()); }
35
git_object_t
targetType
() const noexcept {
return
git_tag_target_type(
tag
()); }
36
38
std::string
name
() const noexcept {
return
git_tag_name(
tag
()); }
40
const
git_signature *
tagger
() const noexcept {
return
git_tag_tagger(
tag
()); }
42
std::string
message
() const noexcept {
return
git_tag_message(
tag
()); }
43
45
std::variant<std::monostate, Commit, Tree, Blob>
peel
() const noexcept;
46
48
GitTy *
tag
() const noexcept {
return
typed
(); }
49
private
:
50
explicit
Tag
(
const
Repo
&
repo
, GitTy *
tag
)
noexcept
;
51
};
52
53
}
SlGit::Blob
Blob is a representation of a git blob.
Definition
Blob.h:16
SlGit::Commit
Commit is a representation of a git commit.
Definition
Commit.h:21
SlGit::Helpers::oidToStr
static std::string oidToStr(const git_oid &id)
Convert OID id to string.
Definition
Helpers.h:20
SlGit::Object::repo
const Repo & repo() const
Get the Repo this Object lives in.
Definition
Object.h:38
SlGit::Repo
The most important Git class.
Definition
Repo.h:45
SlGit::Tag
Tag is a representation of a git tag.
Definition
Tag.h:23
SlGit::Tag::tag
GitTy * tag() const noexcept
Get the stored pointer to libgit2's git_tag.
Definition
Tag.h:48
SlGit::Tag::targetId
const git_oid * targetId() const noexcept
Get the OID of the target of this Tag.
Definition
Tag.h:31
SlGit::Tag::tagger
const git_signature * tagger() const noexcept
Get the tagger of this Tag.
Definition
Tag.h:40
SlGit::Tag::targetIdStr
std::string targetIdStr() const noexcept
Get the SHA of the target of this Tag.
Definition
Tag.h:33
SlGit::Tag::peel
std::variant< std::monostate, Commit, Tree, Blob > peel() const noexcept
Peel this Tag until the underlaying object is found and return that.
SlGit::Tag::name
std::string name() const noexcept
Get the name of this Tag (the tag proper).
Definition
Tag.h:38
SlGit::Tag::message
std::string message() const noexcept
Get the tag message of this Tag.
Definition
Tag.h:42
SlGit::Tag::targetType
git_object_t targetType() const noexcept
Get the type of the target of this Tag (GIT_OBJECT_COMMIT, ...).
Definition
Tag.h:35
SlGit::Tree
Tree is a representation of a git tree.
Definition
Tree.h:27
SlGit::TypedObject< git_tag >::typed
git_tag * typed() const noexcept
Definition
Object.h:83
include
git
Tag.h
Generated by
1.17.0