This repository was archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtag.cpp
More file actions
66 lines (50 loc) · 1.52 KB
/
Copy pathtag.cpp
File metadata and controls
66 lines (50 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <cppgit2/repository.hpp>
namespace cppgit2 {
tag::tag() : c_ptr_(nullptr), owner_(ownership::libgit2) {}
tag::tag(git_tag *c_ptr, ownership owner) : c_ptr_(c_ptr), owner_(owner) {}
tag::~tag() {
if (c_ptr_ && owner_ == ownership::user)
git_tag_free(c_ptr_);
}
tag tag::copy() const {
tag result(nullptr, ownership::user);
if (git_tag_dup(&result.c_ptr_, c_ptr_))
throw git_exception();
return result;
}
oid tag::id() const { return oid(git_tag_id(c_ptr_)); }
std::string tag::message() const {
auto ret = git_tag_message(c_ptr_);
if (ret)
return std::string(ret);
else
return "";
}
std::string tag::name() const {
auto ret = git_tag_name(c_ptr_);
if (ret)
return std::string(ret);
else
return "";
}
object tag::peel() const {
object result(nullptr, ownership::user);
if (git_tag_peel(&result.c_ptr_, c_ptr_))
throw git_exception();
return result;
}
signature tag::tagger() const { return signature(git_tag_tagger(c_ptr_)); }
object tag::target() const {
object result(nullptr, ownership::user);
if (git_tag_target(&result.c_ptr_, c_ptr_))
throw git_exception();
return result;
}
oid tag::target_id() const { return oid(git_tag_target_id(c_ptr_)); }
object::object_type tag::target_type() const {
return static_cast<object::object_type>(git_tag_target_type(c_ptr_));
}
repository tag::owner() const { return repository(git_tag_owner(c_ptr_)); }
git_tag *tag::c_ptr() { return c_ptr_; }
const git_tag *tag::c_ptr() const { return c_ptr_; }
} // namespace cppgit2