App-KGB
view release on metacpan or search on metacpan
t/53-client-git-merges.t view on Meta::CPAN
use strict;
use warnings;
use autodie qw(:all);
use Test::More;
use Test::Differences;
unified_diff();
BEGIN {
eval { require Git; 1 }
or plan skip_all => "Git.pm required for testing Git client";
}
use lib 't';
use TestBot;
use App::KGB::Change;
use App::KGB::Client::Git;
use App::KGB::Client::ServerRef;
use Git;
use File::Temp qw(tempdir);
use File::Spec;
use utf8;
my $builder = Test::More->builder;
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
my $tmp_cleanup = not $ENV{TEST_KEEP_TMP};
my $dir = tempdir( 'kgb-XXXXXXX', CLEANUP => $tmp_cleanup, DIR => File::Spec->tmpdir );
diag "Temp directory $dir will be kept" unless $tmp_cleanup;
my $test_bot = TestBot->start;
sub write_tmp {
my( $fn, $content ) = @_;
open my $fh, '>', "$dir/$fn";
print $fh $content;
close $fh;
}
my $remote = "$dir/there.git";
my $local = "$dir/here";
sub w {
my ( $fn, $content ) = @_;
write_tmp( "here/$fn", "$content\n" );
}
sub a {
my ( $fn, $content ) = @_;
open my $fh, '>>', "$local/$fn";
print $fh $content, "\n";
close $fh;
}
mkdir $remote;
$ENV{GIT_DIR} = $remote;
system 'git', 'init', '--bare';
use Cwd;
my $R = getcwd;
( run in 0.678 second using v1.01-cache-2.11-cpan-6aa56a78535 )