File: protocol.t

package info (click to toggle)
libgit-pure-perl 0.48-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 348 kB
  • sloc: perl: 3,087; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (5)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!perl
use strict;
use warnings;
use Test::More;

BEGIN {
plan skip_all => 'Needs you to manually run a git daemon';

exit 0;

    if ( $^O eq 'MSWin32' ) {
        plan skip_all => 'Windows does NOT have git-daemon yet';
    }
}
use Git::PurePerl;
use IO::File;
use Path::Class;

# git daemon --verbose --reuseaddr --export-all --base-path=/home/acme/git/git-pureperl

my $directory = 'test-protocol';
dir($directory)->rmtree;

my $git = Git::PurePerl->init( directory => $directory );
isa_ok( $git, 'Git::PurePerl', 'can init' );

$git->clone( 'localhost', '/test-project' );

is( $git->all_sha1s->all,   9 );
is( $git->all_objects->all, 9 );

$git->update_master('0c7b3d23c0f821e58cd20e60d5e63f5ed12ef391');

like( $git->master_sha1, qr/^[a-z0-9]{40}$/ );
my $commit = $git->master;

is( $commit->kind, 'commit' );
is( $commit->size, 256 );
like( $commit->sha1, qr/^[a-z0-9]{40}$/ );
is( $commit->tree_sha1, '37b4fcd62571f07408e830f455268891f95cecf5' );
like( $commit->parent_sha1, qr/^[a-z0-9]{40}$/ );
is( $commit->author->name,     'Your Name Comes Here' );
is( $commit->author->email,    'you@yourdomain.example.com' );
is( $commit->committer->name,  'Your Name Comes Here' );
is( $commit->committer->email, 'you@yourdomain.example.com' );
is( $commit->comment,          'add again' );

done_testing;