-
Notifications
You must be signed in to change notification settings - Fork 3
/
Commit.pm6
117 lines (92 loc) · 3.13 KB
/
Commit.pm6
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
use NativeCall;
use Git::Signature;
use Git::Buffer;
use Git::Error;
use Git::Oid;
use Git::Object;
use Git::Tree;
use Git::Describe;
class Git::Commit is repr('CPointer') does Git::Objectish
{
sub git_commit_header_field(Git::Buffer, Git::Commit, Str --> int32)
is native('git2') {}
method author(--> Git::Signature)
is native('git2') is symbol('git_commit_author') {}
method summary(--> Str)
is native('git2') is symbol('git_commit_summary') {}
method body(--> Str)
is native('git2') is symbol('git_commit_body') {}
method message(--> Str)
is native('git2') is symbol('git_commit_message') {}
method encoding(--> Str)
is native('git2') is symbol('git_commit_message_encoding') {}
method committer(--> Git::Signature)
is native('git2') is symbol('git_commit_committer') {}
method header(Str $field --> Str)
{
my Git::Buffer $buf .= new;
check(git_commit_header_field($buf, self, $field));
$buf.str
}
method raw-header(--> Str)
is native('git2') is symbol('git_commit_raw_header') {}
sub git_commit_time(Git::Commit --> int64)
is native('git2') {}
sub git_commit_time_offset(Git::Commit --> int32)
is native('git2') {}
method time(--> DateTime)
{
DateTime.new(git_commit_time(self),
timezone => 60 * git_commit_time_offset(self))
}
sub git_commit_tree_id(Git::Commit --> Pointer)
is native('git2') {}
method tree-id(--> Git::Oid)
{
my $ptr = git_commit_tree_id(self);
Git::Oid.new($ptr)
}
sub git_commit_tree(Pointer is rw, Git::Commit --> int32)
is native('git2') {}
method tree(--> Git::Tree)
{
my Pointer $ptr .= new;
check(git_commit_tree($ptr, self));
nativecast(Git::Tree, $ptr)
}
method parentcount(--> uint32)
is native('git2') is symbol('git_commit_parentcount') {}
sub git_commit_parent_id(Git::Commit, uint32 --> Pointer)
is native('git2') {}
method parent-id(uint32 $n = 0 --> Git::Oid)
{
Git::Oid.new(git_commit_parent_id(self, $n) // return)
}
sub git_commit_parent(Pointer is rw, Git::Commit, uint32 --> int32)
is native('git2') {}
method parent(uint32 $n = 0 --> Git::Commit)
{
my Pointer $ptr .= new;
check(git_commit_parent($ptr, self, $n));
nativecast(Git::Commit, $ptr)
}
sub git_commit_nth_gen_ancestor(Pointer is rw, Git::Commit, uint32 --> int32)
is native('git2') {}
method ancestor(uint32 $n --> Git::Commit)
{
my Pointer $ptr .= new;
check(git_commit_nth_gen_ancestor($ptr, self, $n));
nativecast(Git::Commit, $ptr)
}
sub git_describe_commit(Pointer is rw, Git::Commit, Git::Describe::Options
--> int32)
is native('git2') {}
method describe(|opts)
{
my Git::Describe::Options $opts .= new(|opts);
my Pointer $ptr .= new;
check(git_describe_commit($ptr, self, $opts));
nativecast(Git::Describe::Result, $ptr);
}
submethod DESTROY { self.free }
}