@@ -18,12 +18,14 @@ has 'committer' =>
18
18
has ' committed_time' => ( is => ' rw' , isa => ' DateTime' , required => 0 );
19
19
has ' comment' => ( is => ' rw' , isa => ' Str' , required => 0 );
20
20
has ' encoding' => ( is => ' rw' , isa => ' Str' , required => 0 );
21
+ has ' gpg_signature' => ( is => ' rw' , isa => ' Str' , required => 0 );
21
22
22
23
my %method_map = (
23
24
' tree' => ' tree_sha1' ,
24
25
' parent' => ' _push_parent_sha1' ,
25
26
' author' => ' authored_time' ,
26
- ' committer' => ' committed_time'
27
+ ' committer' => ' committed_time' ,
28
+ ' gpgsig' => ' gpg_signature' ,
27
29
);
28
30
29
31
sub BUILD {
@@ -32,6 +34,26 @@ sub BUILD {
32
34
my @lines = split " \n " , $self -> content;
33
35
my %header ;
34
36
while ( my $line = shift @lines ) {
37
+
38
+ # Apparent format is roughly:
39
+ #
40
+ # <token><space><DATA>
41
+ # <space><DATA> # repeated
42
+ #
43
+ # And a line not leading with <space> ends the token.
44
+ #
45
+ # Though, at present, git itself has this special-cased for GPG Signatures.
46
+ #
47
+ # Its probably extendable to support any value of <token> though.
48
+ if ( $line =~ / ^gpgsig (.*$) / ) {
49
+ my $sig = " $1 " ;
50
+ while ( $line = $lines [0] ) {
51
+ last unless $line =~ / ^ (.*$) / ;
52
+ $sig .= " $1 \n " ;
53
+ shift @lines ;
54
+ }
55
+ push @{ $header {gpgsig } }, $sig ;
56
+ }
35
57
last unless $line ;
36
58
my ( $key , $value ) = split ' ' , $line , 2;
37
59
push @{$header {$key }}, $value ;
0 commit comments