FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
git2cpp/src/wrapper/commit_wrapper.cpp at main · QuantStack/git2cpp · GitHub
QuantStack
git2cpp
Repository navigation
Code
Issues
6
(6)
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
git2cpp
/
src
/
wrapper
/
commit_wrapper.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
72 lines (59 loc) · 1.59 KB
Breadcrumbs
git2cpp
/
src
/
wrapper
/
commit_wrapper.cpp
Copy path
File metadata and controls
72 lines (59 loc) · 1.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
67
68
69
70
71
72
#
include
"
../wrapper/commit_wrapper.hpp
"
#
include
<
git2/commit.h
>
#
include
"
../utils/git_exception.hpp
"
#
include
"
tree_wrapper.hpp
"
commit_wrapper::commit_wrapper
(git_commit* commit)
: base_type(commit)
{
}
commit_wrapper::~commit_wrapper
()
{
git_commit_free
(p_resource);
p_resource =
nullptr
;
}
commit_wrapper::
operator
git_object*()
const
noexcept
{
return
reinterpret_cast
<git_object*>(p_resource);
}
const
git_oid&
commit_wrapper::oid
()
const
{
return
*
git_commit_id
(p_resource);
}
std::string
commit_wrapper::commit_oid_tostr
()
const
{
char
buf[
GIT_OID_SHA1_HEXSIZE
+
1
];
return
git_oid_tostr
(buf,
sizeof
(buf), &
this
->
oid
());
}
std::string
commit_wrapper::message
()
const
{
return
git_commit_message
(*
this
);
}
std::string
commit_wrapper::summary
()
const
{
return
git_commit_summary
(*
this
);
}
commit_wrapper
commit_wrapper::get_parent
(
size_t
i)
const
{
git_commit* parent;
throw_if_error
(
git_commit_parent
(&parent, *
this
, i));
return
commit_wrapper
(parent);
}
commit_list_wrapper
commit_wrapper::get_parents_list
()
const
{
size_t
parent_count =
git_commit_parentcount
(*
this
);
std::vector<commit_wrapper> parents_list;
parents_list.
reserve
(parent_count);
for
(
size_t
i =
0
; i < parent_count; ++i)
{
git_commit* parent;
git_commit_parent
(&parent, *
this
, i);
parents_list.
push_back
(
commit_wrapper
(parent));
}
return
commit_list_wrapper
(
std::move
(parents_list));
}
tree_wrapper
commit_wrapper::tree
()
const
{
git_tree* tree;
throw_if_error
(
git_commit_tree
(&tree, *
this
));
return
tree_wrapper
(tree);
}
Back
|
FazBrowse Home
|
New Git URL