File: push-multi.t

package info (click to toggle)
libdist-zilla-plugin-git-perl 2.051-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 712 kB
  • sloc: perl: 1,306; makefile: 11
file content (56 lines) | stat: -rw-r--r-- 1,523 bytes parent folder | download
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
49
50
51
52
53
54
55
56
use strict;
use warnings;

use Git::Wrapper;
use Path::Tiny qw(path);
use Test::More 0.88;            # done_testing

use lib 't/lib';
use Util;

skip_unless_git_version('2.4.1'); # for push.followTags

plan tests => 7;

init_test(corpus => 'push-multi');

$git->add( qw{ dist.ini Changes } );
$git->commit( { message => 'initial commit' } );

# create a clone, and use it to set up origin
my $clone1 = $base_dir->child('clone1');
my $clone2 = $base_dir->child('clone2');
$git->clone( { quiet=>1, 'no-checkout'=>1, bare=>1 }, "$git_dir", "$clone1" );
$git->clone( { quiet=>1, 'no-checkout'=>1, bare=>1 }, "$git_dir", "$clone2" );
$git->remote('add', 'origin', "$clone1");
$git->remote('add', 'another', "$clone2");
$git->config('branch.master.remote', 'origin');
$git->config('branch.master.merge', 'refs/heads/master');

# do the release
append_to_file('Changes',  "\n");
append_to_file('dist.ini', "\n");

new_zilla_from_repo;
$zilla->release;

# Check log
zilla_log_is('Git::Push', <<'');
[Git::Push] pushing to origin
[Git::Push] pushing to another

for my $c ( $clone1, $clone2 ) {
  # check if everything was pushed
  my $git = Git::Wrapper->new( "$c" );
  my $cName = $c->basename;
  my ($log) = $git->log( 'HEAD' );
  like( $log->message, qr/v1.23\n[^a-z]*foo[^a-z]*bar[^a-z]*baz/,
        "commit pushed to $cName" );

  # check if tag has been correctly created
  my @tags = $git->tag;
  is( scalar(@tags), 1, "one tag pushed to $cName" );
  is( $tags[0], 'v1.23', "found v1.23 tag in $cName" );
}

done_testing;