3 # this is meant to be run on your *client* (where you edit and commit files
4 # in a gitolite-admin *working* repo), not on the gitolite server.
9 # To use this, first upgrade gitolite to the latest on the server; you need at
12 # Then, on the client:
14 # 1. copy this file (contrib/utils/testconf in the latest gitolite) to
15 # somewhere in your $PATH
16 # 2. modify the following lines if you wish (default should be fine for
19 # a semi-permanent area to play in (please delete it manually if you want to start afresh).
20 testconf
=$HOME/GITOLITE-TESTCONF
21 # the gitolite source code
22 gitolite_url
=https
://github.com
/sitaramc
/gitolite
24 # 3. go to your gitolite-admin clone and make suitable changes; see example
25 # below. No need to push to the server, yet.
28 # CAVEAT: include files are not handled the same way gitolite parsing handles
29 # them -- we just cat all the conf files together, in sorted order.
31 # If the tests ran OK, push your changes to the server as usual.
33 # EXAMPLE changes to gitolite.conf
34 # ================================
35 # Say you have these rules in the conf file:
42 # To create test code for this, add the following lines to the conf file.
45 # # you can put arbitrary bash code here, but a simple example follows
47 # ok() { "$@" && echo ok || echo "not ok ($*)"; }
48 # nok() { ! "$@" && echo ok || echo "not ok ($*)"; }
50 # ok gitolite access -q foo u1 R
51 # nok gitolite access -q foo u1 W
53 # ok gitolite access -q foo u2 W
54 # nok gitolite access -q foo u2 +
56 # ok gitolite access -q foo u3 +
59 # Note that you can actually put in any bash code between the 'begin' and
60 # 'end' lines; the above is just a useful sample/template.
62 # Because of the 'begin' and 'end' lines, gitolite will ignore those lines
63 # when processing the conf file ON THE SERVER.
65 # (optional) TAP compliance
66 # =========================
67 # if you add a line 'echo 1..5' (in this case, since there are 5 ok/nok lines;
68 # you will certainly have more) to the top the file, you can run
70 # prove `which testconf`
72 # which will give you a much nicer output. The only issue is if you have
73 # include files, you will need to put that in the file whose name is sorted
76 # Using a non-default ".gitolite.rc"
77 # ==================================
79 # If your conf needs a non-default `~/.gitolite.rc`, copy the file you need as
80 # "testconf.gitolite.rc" in the root directory of the gitolite-admin clone
81 # where you are running "testconf". (Whether you commit this file to the
82 # gitolite-admin repo, or keep it local/untracked, is your call).
84 # ----------------------------------------------------------------------
93 export PATH
=$PWD/gitolite
/src
:$PATH
97 echo getting gitolite
source...
98 git clone
$gitolite_url gitolite
101 echo installing gitolite...
102 gitolite
/install >/dev
/null
105 echo setting up gitolite...
106 gitolite setup
-a admin
113 rm -rf $testconf/.gitolite
/conf
114 mkdir
-p $testconf/.gitolite
/conf
115 cp -a $od/conf
/* $testconf/.gitolite
/conf
/
117 # copy rc from $od, if it exists
118 [ -f $od/testconf.gitolite.rc
] && cp $od/testconf.gitolite.rc
$testconf/.gitolite.rc
123 gitolite trigger POST_COMPILE
125 # snarf bits of code from conf files and run them
127 cat `find $testconf/.gitolite/conf -type f -name "*.conf" | sort` |
129 print if /^=begin testconf$/ .. /^=end$/ and not /^=(begin|end)/;