Help language development. Donate to The Perl Foundation

LibGit2 cpan:CTILMES last updated on 2020-08-18

use Test;
use Test::When <online>;
use File::Temp;
use LibGit2;

plan 11;

my $remote = '';

my $repodir = tempdir;

ok my $repo = Git::Repository.clone($remote, $repodir), 'clone';

ok my $ref = $repo.reference-lookup('refs/heads/master'), 'reference master';

is $, True, 'is-branch';

is $, False, 'is-tag';

is $, False, 'is-note';

is $, False, 'is-remote';

ok $ref = $repo.ref('master'), 'ref master';

is $, True, 'is-branch';

ok (my @list = $repo.reference-list()), 'reference-list';

is-deeply ${.name}).sort,
	<refs/heads/master refs/remotes/origin/master refs/tags/0.1 refs/tags/0.2>,
	'references names';

is-deeply ${.short}).sort,
	('0.1', '0.2', 'master', 'origin/master'),
	'references short names';