File: 31-annotated_commit.t

package info (click to toggle)
libgit-raw-perl 0.79-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,448 kB
  • sloc: perl: 5,267; ansic: 182; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (2)
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
#!perl

use Test::More;

use Git::Raw;
use Cwd qw(abs_path);
my $path = abs_path('t/test_repo');
my $repo = Git::Raw::Repository -> open($path);

my @revs = $repo -> revparse ('HEAD');
is scalar(@revs), 1;
my $commit = shift @revs;
isa_ok $commit, 'Git::Raw::Commit';

my $annotated = $commit -> annotated;
isa_ok $annotated, 'Git::Raw::AnnotatedCommit';
is $commit -> id, $annotated -> id;
is $commit -> id , "$annotated";


my $head = $repo -> head;
isa_ok $head, 'Git::Raw::Reference';
$annotated = $head -> annotated_commit;
isa_ok $annotated, 'Git::Raw::AnnotatedCommit';
is $commit -> id, $annotated -> id;


my $annotated2 = Git::Raw::AnnotatedCommit -> lookup($repo, $commit -> id);
isa_ok $annotated2, 'Git::Raw::AnnotatedCommit';
is $annotated2 -> id, $annotated -> id;

done_testing;