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

« back to all changes in this revision

Viewing changes to t/0-me-first.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
my $rb = `gitolite query-rc -n GL_REPO_BASE`;
 
10
 
 
11
# initial smoke tests
 
12
# ----------------------------------------------------------------------
 
13
 
 
14
try "plan 71";
 
15
 
 
16
# basic push admin repo
 
17
confreset;confadd '
 
18
    repo aa
 
19
        RW+     =   u1
 
20
        RW      =   u2 u3
 
21
 
 
22
    repo cc/..*
 
23
        C       =   u4
 
24
        RW+     =   CREATOR u5
 
25
';
 
26
 
 
27
try "ADMIN_PUSH set1; !/FATAL/" or die text();
 
28
 
 
29
try "
 
30
                                            /Initialized empty Git repository in .*/aa.git//
 
31
 
 
32
    # basic clone
 
33
    cd ..
 
34
    glt clone u1 file://aa u1aa;    ok;     /Cloning into 'u1aa'.../
 
35
                                            /warning: You appear to have cloned an empty repository/
 
36
    [ -d u1aa ];                    ok
 
37
 
 
38
    # basic clone deny
 
39
    glt clone u4 file://aa u4aa;    !ok;    /R any aa u4 DENIED by fallthru/
 
40
    [ -d u4aa ];                    !ok
 
41
 
 
42
    # basic push
 
43
    cd u1aa;                        ok
 
44
    tc z-507;                       ok;     /master .root-commit. 7cf7624. z-507/
 
45
    glt push u1 origin HEAD;        ok;     /To file://aa/
 
46
                                            /\\[new branch\\] *HEAD -> master/
 
47
 
 
48
    # basic rewind
 
49
    tc o-866 o-867 o-868;           ok;     /master 2d066fb. o-868/
 
50
    glt push u1 origin HEAD;        ok;     /7cf7624..2d066fb  HEAD -> master/
 
51
    git reset --hard HEAD^;         ok;     /HEAD is now at 8b1456b o-867/
 
52
    tc x-967;                       ok;     /master 284951d. x-967/
 
53
    glt push u1 -f origin HEAD;     ok;     /\\+ 2d066fb...284951d HEAD -> master \\(forced update\\)/
 
54
 
 
55
    # log file
 
56
    cat \$(gitolite query-rc GL_LOGFILE);
 
57
                                    ok;     /\tupdate\t/
 
58
                                            /aa\tu1\t\\+\trefs/heads/master/
 
59
                                            /2d066fb4860c29cf321170c17695c6883f3d50e8/
 
60
                                            /284951dfa11d58f99ab76b9f4e4c1ad2f2461236/
 
61
 
 
62
    # basic rewind deny
 
63
    cd ..
 
64
    glt clone u2 file://aa u2aa;    ok;     /Cloning into 'u2aa'.../
 
65
    cd u2aa;                        ok
 
66
    tc g-776 g-777 g-778;           ok;     /master 9cbc181. g-778/
 
67
    glt push u2 origin HEAD;        ok;     /284951d..9cbc181  HEAD -> master/
 
68
    git reset --hard HEAD^;         ok;     /HEAD is now at 2edf7fc g-777/
 
69
    tc d-485;                       ok;     /master 1c01d32. d-485/
 
70
    glt push u2 -f origin HEAD;     !ok;    reject
 
71
                                            /\\+ refs/heads/master aa u2 DENIED by fallthru/
 
72
 
 
73
    # non-existent repos etc
 
74
    glt ls-remote u4 file:///bb;    !ok;    /DENIED by fallthru/
 
75
    glt ls-remote u4 file:///cc/1;  ok;     /Initialized empty/
 
76
    glt ls-remote u5 file:///cc/1;  ok;     perl s/TRACE.*//g; !/\\S/
 
77
    glt ls-remote u5 file:///cc/2;  !ok;    /DENIED by fallthru/
 
78
    glt ls-remote u6 file:///cc/2;  !ok;    /DENIED by fallthru/
 
79
 
 
80
    # command
 
81
    glt perms u4 -c cc/bar/baz/frob + READERS u2;
 
82
                                    ok;     /Initialized empty .*cc/bar/baz/frob.git/
 
83
 
 
84
    # path traversal
 
85
    glt ls-remote u4 file:///cc/dd/../ee
 
86
                                    !ok;    /FATAL: 'cc/dd/\\.\\./ee' contains '\\.\\.'/
 
87
    glt ls-remote u5 file:///cc/../../../../../..$rb/gitolite-admin
 
88
                                    !ok;    /FATAL: 'cc/../../../../../..$rb/gitolite-admin' contains '\\.\\.'/
 
89
 
 
90
    glt perms u4 -c cc/bar/baz/../frob + READERS u2
 
91
                                    !ok;    /FATAL: 'cc/bar/baz/\\.\\./frob' contains '\\.\\.'/
 
92
 
 
93
 
 
94
";