Git-Sub

 view release on metacpan or  search on metacpan

t/git.t  view on Meta::CPAN

git::init;
ok( -d "$dir/.git", '[init] Initialize repositry ' );
$tested{init}++;

# create the emptry tree
my $tree = git::mktree( \'' );
is( $tree, '4b825dc642cb6eb9a060e54bf8d69288fbee4904', '[mktree] Creating empty tree' );
$tested{mktree}++;

# commit it
$ENV{GIT_AUTHOR_DATE}    = 'Mon Jan 21 21:14:18 CET 2013';
$ENV{GIT_COMMITTER_DATE} = 'Mon Jan 21 21:14:18 CET 2013';
my $commit = git::commit_tree $tree, \'empty tree';
$tested{commit_tree}++;
is( $commit, '52870678501379ecd14277fad5e69961ce7bd39b', '[commit_tree] Committing empty tree' );

# point master to it
git::update_ref 'refs/heads/master', $commit;
$tested{update_ref}++;

# check we got it right
my $log = git::log qw( --pretty=format:%H -1 );

t/git.t  view on Meta::CPAN

is_deeply( [ git::status '--porcelain' ],
    ['?? hello.txt'], '[status --porcelain] Status with missing file' );
$tested{status}++;
git::add 'hello.txt';
$tested{add}++;
is_deeply( [ git::status '--porcelain' ],
    ['A  hello.txt'], '[status --porcelain] Status with added file' );
$tested{status}++;

# and commit it
$ENV{GIT_AUTHOR_DATE}    = 'Mon Jan 21 21:14:19 CET 2013';
$ENV{GIT_COMMITTER_DATE} = 'Mon Jan 21 21:14:19 CET 2013';
git::commit -m => 'hello';
$tested{commit}++;
$commit = git::log qw( -1 --pretty=format:%H );
$tested{log}++;
is( $commit, 'b462686c994180efe7fcf5e4e682907834c93f38', '[log] Verify commit' );

# check an unsupported command
use Git::Sub 'show_branch';
is_deeply(
    [ git::show_branch '--all' ],



( run in 0.661 second using v1.01-cache-2.11-cpan-49f99fa48dc )