use Moose::Autobox;
use List::MoreUtils qw/any zip/;
use DateTime;
- use Gitalist::Util qw(to_utf8);
use Gitalist::Git::Object::Blob;
use Gitalist::Git::Object::Tree;
use Gitalist::Git::Object::Commit;
has heads => ( isa => ArrayRef[HashRef],
is => 'ro',
lazy_build => 1);
+=head2 tags
+
+ArrayRef of hashes containing the name and sha1 of all tags.
+
+=cut
+ has tags => ( isa => ArrayRef[HashRef],
+ is => 'ro',
+ lazy_build => 1);
=head2 references
$format = $formats->{$format};
my $name = $self->name;
$name =~ s,([^/])/*\.git$,$1,;
- my $filename = to_utf8($name);
+ my $filename = $name;
$filename .= "-$sha1.$format";
$name =~ s/\047/\047\\\047\047/g;
-
my @cmd = ('archive', "--format=$format", "--prefix=$name/", $sha1);
return ($filename, $self->run_cmd_fh(@cmd));
# TODO - support compressed archives
return \@ret;
}
+ method _build_tags {
+ my @revlines = $self->run_cmd_list('for-each-ref',
+ '--sort=-creatordate',
+ '--format=%(objectname) %(objecttype) %(refname) %(*objectname) %(*objecttype) %(subject)%00%(creator)',
+ 'refs/tags'
+ );
+ my @ret;
+ for my $line (@revlines) {
+ my($refinfo, $creatorinfo) = split /\0/, $line;
+ my($rev, $type, $name, $refid, $reftype, $title) = split(' ', $refinfo, 6);
+ my($creator, $epoch, $tz) = ($creatorinfo =~ /^(.*) ([0-9]+) (.*)$/);
+ $name =~ s!^refs/tags/!!;
+
+ push @ret, { sha1 => $rev, name => $name };
+
+ #FIXME: That isn't the time I'm looking for..
+ if($epoch and $tz) {
+ my $dt = DateTime->from_epoch(epoch => $epoch);
+ $dt->set_time_zone($tz);
+ $ret[-1]->{last_change} = $dt;
+ }
+ }
+
+ return \@ret;
+ }
+
method _build_references {
# 5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c refs/tags/v2.6.11
# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}