my $commit = $commitdata{$sha1};
my $line;
- until(($line = shift @blameout) =~ s/^\t//) {
- $commit->{$1} = $2
- if $line =~ /^(\S+) (.*)/;
+
+ until(@blameout == 0 || ($line = shift @blameout) =~ s/^\t//) {
+ $commit->{$1} = $2 if $line =~ /^(\S+) (.*)/;
}
unless(exists $commit->{author_dt}) {
my $repoBare = Path::Class::Dir->new('t/lib/repositories/bare.git');
ok( $repo->_is_git_repo( $repoBare ), 'is_git_repo true for bare git repo' );
-# 'working' is a working copy w/ git repo in the repository dir
-my $repoWorking = Path::Class::Dir->new('t/lib/repositories/working');
-
# 'empty.git' is an empty directory in the repository dir
my $repoEmpty = Path::Class::Dir->new('t/lib/repositories/empty.git');
ok( ! $repo->_is_git_repo( $repoEmpty ), 'is_git_repo is false for empty dir' );
my %references = %{$proj->references};
ok(keys %references >= 2, '->references hash has elements');
-is($references{'36c6c6708b8360d7023e8a1649c45bcf9b3bd818'}->[0], 'heads/master', 'reference looks ok');
+is($references{'36c6c6708b8360d7023e8a1649c45bcf9b3bd818'}->[0], 'tags/0.01', 'reference looks ok');
my @heads = @{$proj->heads};
ok(scalar @heads > 1, '->heads list has more than one element');
my $head = $heads[1];
isa_ok($head, 'Gitalist::Git::Head');
-is($proj->head_hash, '36c6c6708b8360d7023e8a1649c45bcf9b3bd818', 'head_hash for HEAD is correct');
-is($proj->head_hash('refs/heads/master'), '36c6c6708b8360d7023e8a1649c45bcf9b3bd818', 'head_hash for refs/heads/master is correct');
+is($proj->head_hash, 'd6ddf8b26be63066e01d96a0922c87cd8d6e2270', 'head_hash for HEAD is correct');
+is($proj->head_hash('refs/heads/master'), 'd6ddf8b26be63066e01d96a0922c87cd8d6e2270', 'head_hash for refs/heads/master is correct');
is($proj->head_hash('rafs/head/mister'), undef, 'head_hash for rafs/head/mister is undef');
ok(scalar @{$proj->tags} == 1, '->tags list has one element');
heads => [
{
__CLASS__ => 'Gitalist::Git::Head',
+ committer => 'Dan Brook <broq@cpan.org>',
+ last_change => '2011-06-05T23:00:44Z',
+ name => 'master',
+ sha1 => 'd6ddf8b26be63066e01d96a0922c87cd8d6e2270',
+ },
+ {
+ __CLASS__ => 'Gitalist::Git::Head',
committer => 'Zachary Stevens <zts@cryptocracy.com>',
last_change => '2009-11-12T19:00:34Z',
name => 'branch1',
sha1 => '0710a7c8ee11c73e8098d08f9384c2a839c65e4e'
},
- {
- __CLASS__ => 'Gitalist::Git::Head',
- committer => 'Florian Ragwitz <rafl@debian.org>',
- last_change => '2007-03-06T20:44:35Z',
- name => 'master',
- sha1 => '36c6c6708b8360d7023e8a1649c45bcf9b3bd818'
- }
],
is_bare => 1,
- last_change => '2009-11-12T19:00:34Z',
+ last_change => '2011-06-05T23:00:44Z',
name => 'repo1',
owner => "T\351st",
references => {
- "36c6c6708b8360d7023e8a1649c45bcf9b3bd818" => [
- 'heads/master',
- 'tags/0.01'
- ],
+ "d6ddf8b26be63066e01d96a0922c87cd8d6e2270" => ['heads/master'],
+ "36c6c6708b8360d7023e8a1649c45bcf9b3bd818" => ['tags/0.01'],
"0710a7c8ee11c73e8098d08f9384c2a839c65e4e" => [ 'heads/branch1' ]
},
tags => [ {
use_ok 'Gitalist::Git::Object::Blob';
use_ok 'Gitalist::Git::Object::Commit';
use_ok 'Gitalist::Git::Object::Tag';
- }
+}
my $object = Gitalist::Git::Object::Tree->new(
repository => $repository,
__CLASS__ => 'Gitalist::Git::Repository',
description => 'some test repository',
is_bare => 1,
- last_change => '2009-11-12T19:00:34Z',
+ last_change => '2011-06-05T23:00:44Z',
name => 'repo1',
owner => code(\&is_system_account_name),
},
__CLASS__ => 'Gitalist::Git::Repository',
description => 'some test repository',
is_bare => 1,
- last_change => '2009-11-12T19:00:34Z',
+ last_change => '2011-06-05T23:00:44Z',
name => 'repo1',
owner => code(\&is_system_account_name),
},
__CLASS__ => 'Gitalist::Git::Repository',
description => 'some test repository',
is_bare => 1,
- last_change => '2009-11-12T19:00:34Z',
+ last_change => '2011-06-05T23:00:44Z',
name => 'repo1',
owner => code(\&is_system_account_name),
},
__CLASS__ => 'Gitalist::Git::Repository',
description => 'some test repository',
is_bare => 1,
- last_change => '2009-11-12T19:00:34Z',
+ last_change => '2011-06-05T23:00:44Z',
name => 'repo1',
owner => code(\&is_system_account_name),
},
'commit_obj->get_patch can return a patchset')
or warn("Contents was $contents");
}
+
+my $blame_this = Gitalist::Git::Object::Commit->new(
+ repository => $repository,
+ sha1 => 'd6ddf8b26be63066e01d96a0922c87cd8d6e2270',
+);
+
+{
+ local $SIG{ALRM} = sub { die "Regressions suck!" };
+ alarm 1;
+ eval { $blame_this->blame('empty-for-a-reason', $blame_this->sha1) };
+ is $@, '', "Silly infinite loop didn't manifest for an empty file.";
+}
+
done_testing;
sub is_system_account_name {
is_deeply $data, {
'is_bare' => 1,
'__CLASS__' => 'Gitalist::Git::Repository',
- 'last_change' => '2009-11-12T19:00:34Z',
+ 'last_change' => '2011-06-05T23:00:44Z',
'name' => 'repo1',
'description' => 'some test repository'
};
--- /dev/null
+x\ 1]\ 21\10}Î)ú}A:I§',"{\ 5\ f\ e:\137\13a¿Á\e\bEQ|EA¥º,s\aC´ëM\ 4
+ÄXl!ëP×¥xv6qr4z&k\aËò>zË'4V|ÐLD.¦r6f¯½
+¯~«\r~Â
+çVë\1d±ÕßSzu_Ûõ\e´Åià\v\r¢Jïk]>\1a©Ë&Ðoó\ 6e~T¡ËÖ\a\11°\f\7f]áÝþIÞ«\7fO^L\17
\ No newline at end of file
-36c6c6708b8360d7023e8a1649c45bcf9b3bd818
+d6ddf8b26be63066e01d96a0922c87cd8d6e2270
+++ /dev/null
-This directory represents a working git repository (as opposed to a bare one).