FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
git2cpp/src/wrapper/signature_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
/
signature_wrapper.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
79 lines (68 loc) · 2.26 KB
Breadcrumbs
git2cpp
/
src
/
wrapper
/
signature_wrapper.cpp
Copy path
File metadata and controls
79 lines (68 loc) · 2.26 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
73
74
75
76
77
78
79
#
include
"
../wrapper/signature_wrapper.hpp
"
#
include
<
git2/types.h
>
#
include
"
../utils/git_exception.hpp
"
#
include
"
../wrapper/repository_wrapper.hpp
"
signature_wrapper::~signature_wrapper
()
{
if
(m_ownership)
{
git_signature_free
(p_resource);
}
p_resource =
nullptr
;
}
std::string_view
signature_wrapper::name
()
const
{
return
p_resource->
name
;
}
std::string_view
signature_wrapper::email
()
const
{
return
p_resource->
email
;
}
git_time
signature_wrapper::when
()
const
{
return
p_resource->
when
;
}
signature_wrapper::author_committer_signatures
signature_wrapper::get_default_signature_from_env
(repository_wrapper& rw)
{
signature_wrapper author;
signature_wrapper committer;
throw_if_error
(
git_signature_default_from_env
(&(author.
p_resource
), &(committer.
p_resource
), rw));
return
{
std::move
(author),
std::move
(committer)};
}
signature_wrapper
signature_wrapper::get_commit_author
(
const
commit_wrapper& cw)
{
signature_wrapper author;
author.
p_resource
=
const_cast
<git_signature*>(
git_commit_author
(cw));
author.
m_ownership
=
false
;
return
author;
}
signature_wrapper
signature_wrapper::get_commit_committer
(
const
commit_wrapper& cw)
{
signature_wrapper committer;
committer.
p_resource
=
const_cast
<git_signature*>(
git_commit_committer
(cw));
committer.
m_ownership
=
false
;
return
committer;
}
signature_wrapper
signature_wrapper::signature_now
(std::string_view name, std::string_view email)
{
signature_wrapper sw;
git_signature* signature;
throw_if_error
(
git_signature_now
(&signature, name.
data
(), email.
data
()));
sw.
p_resource
= signature;
sw.
m_ownership
=
true
;
return
sw;
}
signature_wrapper::author_committer_signatures
signature_wrapper::signature_now
(
std::string_view author_name,
std::string_view author_email,
std::string_view committer_name,
std::string_view committer_email
)
{
signature_wrapper author_sig =
signature_now
(author_name.
data
(), author_email.
data
());
signature_wrapper cmt_sig =
signature_now
(committer_name.
data
(), committer_email.
data
());
//
Deep copy of "when", which contains only copiable values, not pointers
cmt_sig.
p_resource
->
when
= author_sig.
p_resource
->
when
;
return
std::pair
(
std::move
(author_sig),
std::move
(cmt_sig));
}
Back
|
FazBrowse Home
|
New Git URL