~ubuntu-branches/ubuntu/utopic/gitolite3/utopic

« back to all changes in this revision

Viewing changes to t/merge-check.t

  • Committer: Package Import Robot
  • Author(s): David Bremner
  • Date: 2013-05-18 17:59:21 UTC
  • Revision ID: package-import@ubuntu.com-20130518175921-ac4xe6vd0jtxvjot
Tags: upstream-3.5.1+4
ImportĀ upstreamĀ versionĀ 3.5.1+4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
# this is hardcoded; change it if needed
 
6
use lib "src/lib";
 
7
use Gitolite::Test;
 
8
 
 
9
# merge check -- the M flag
 
10
# ----------------------------------------------------------------------
 
11
 
 
12
try "plan 55";
 
13
 
 
14
confreset;confadd '
 
15
    repo  foo
 
16
          RW+M      =   u1
 
17
          RW+       =   u2
 
18
          RWM      .=   u3
 
19
          RW        =   u4
 
20
';
 
21
 
 
22
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
23
 
 
24
# setup a merged push
 
25
 
 
26
try "
 
27
    cd ..
 
28
    [ -d foo ];         !ok
 
29
    glt clone u1 file:///foo
 
30
                        ok;     /Cloning into/
 
31
                                /You appear to have cloned an empty/
 
32
";
 
33
 
 
34
try "
 
35
    cd foo;             ok
 
36
    [ -d .git ];        ok
 
37
    test-commit aa;     ok;     /1 file changed, 1 insertion/
 
38
    tag start;          ok
 
39
    glt push u1 origin master
 
40
                        ok;     /new branch.*master.-..master/
 
41
                                /create.delete ignored.*merge-check/
 
42
    checkout -b new;    ok;     /Switched to a new branch 'new'/
 
43
    test-commit bb cc;  ok
 
44
    checkout master;    ok;     /Switched to branch 'master'/
 
45
    test-commit dd ee;  ok
 
46
    git merge new;      ok;     /Merge made.*recursive/
 
47
    test-commit ff;     ok
 
48
    tag end;            ok
 
49
";
 
50
 
 
51
# push by u4 should fail
 
52
try "
 
53
    glt push u4 file:///foo master
 
54
                        !ok;    /WM refs/heads/master foo u4 DENIED by fallthru/
 
55
                                /To file:///foo/
 
56
                                /remote rejected.*hook declined/
 
57
                                /failed to push some refs/
 
58
";
 
59
 
 
60
# push by u3 should succeed
 
61
try "
 
62
    glt push u3 file:///foo master
 
63
                        ok;     /To file:///foo/; /master.-..master/
 
64
";
 
65
 
 
66
# rewind by u3 should fail
 
67
try "
 
68
    reset-h start;      ok;     /HEAD is now at .* aa /
 
69
    glt push u3 file:///foo +master
 
70
                         !ok;   /rejected.*hook declined/
 
71
                                /failed to push some refs/
 
72
";
 
73
 
 
74
# rewind by u2 should succeed
 
75
try "
 
76
    glt push u2 file:///foo +master
 
77
                         ok;    /To file:///foo/
 
78
                                /forced update/
 
79
";
 
80
 
 
81
# push by u2 should fail
 
82
try "
 
83
    reset-h end;        ok;     /HEAD is now at .* ff /
 
84
    glt push u2 file:///foo master
 
85
                        !ok;    /WM refs/heads/master foo u2 DENIED by fallthru/
 
86
                                /To file:///foo/
 
87
                                /remote rejected.*hook declined/
 
88
                                /failed to push some refs/
 
89
";
 
90
 
 
91
# push by u1 should succeed
 
92
try "
 
93
    glt push u1 file:///foo master
 
94
                        ok;     /master.-..master/
 
95
";