3 # ----------------------------------------------------------------------
4 # change these lines to suit
5 testconf
=$HOME/GITOLITE-TESTCONF
6 gitolite_url
=https
://github.com
/sitaramc
/gitolite
7 # change it to something local for frequent use
8 # gitolite_url=file:///tmp/gitolite.git
10 # ----------------------------------------------------------------------
11 # Usage: gitolite-local <options>
13 # Test your gitolite.conf rule lists on your LOCAL machine (without even
14 # pushing to the server!)
18 # 1. put this code somewhere in your $PATH if you wish
19 # 2. edit the line near the top of the script if you want to use some other
20 # directory than the default, for "testconf".
21 # 2. prepare the "testconf" directory by running:
24 # (lather, rinse, repeat)
26 # 1. edit the conf (see notes below for more)
29 # gitolite-local compile
30 # 3. check permissions using "info" command:
31 # gitolite-local info USERNAME
32 # 4. check permissions using "access" command:
33 # gitolite-local access <options for gitolite access command>
34 # 5. clone, fetch, and push if you like!
35 # gitolite-local clone <username> <reponame> <other options for clone>
36 # gitolite-local fetch <username> <options for fetch>
37 # gitolite-local push <username> <options for push>
39 # note on editing the conf: you don't have to use the edit command; you can
40 # also directly edit '.gitolite/conf/gitolite.conf' in the 'testconf'
41 # directory. You'll need to do that if your gitolite conf consists of more
42 # than just one file (like if you have includes, etc.)
44 # note on the clone command: most of the options won't work for clone, unless
45 # git is ok with them being placed *after* the repo name.
47 # ----------------------------------------------------------------------
48 die
() { echo "$@" >&2; exit 1; }
49 usage
() { perl
-lne 'print substr($_, 2) if /^# Usage/../^$/' < $0; exit 1; }
52 # ----------------------------------------------------------------------
57 [ -d $testconf ] && die
"directory '$testconf' already exists"
64 echo getting gitolite
source...
65 git clone
$gitolite_url gitolite
68 echo installing gitolite...
69 gitolite
/install >/dev
/null
72 echo setting up gitolite...
73 export PATH
=$PWD/gitolite
/src
:$PATH
74 gitolite setup
-a admin
83 export PATH
=$PWD/gitolite
/src
:$PATH
88 $editor .gitolite
/conf
/gitolite.conf
92 elif [ $1 = compile
+ ]
94 gitolite compile\
; gitolite trigger POST_COMPILE
101 GL_USER
=$user gitolite info
"$@"
114 export GL_BINDIR
=$HOME/gitolite
/t
115 # or you could do it the long way, using 'gitolite query-rc GL_BINDIR'
117 git clone
--upload-pack=$GL_BINDIR/gitolite-upload-pack
file:///$repo "$@"
125 export GL_BINDIR
=$HOME/gitolite
/t
126 git fetch
--upload-pack=$GL_BINDIR/gitolite-upload-pack
"$@"
134 export GL_BINDIR
=$HOME/gitolite
/t
135 git push
--receive-pack=$GL_BINDIR/gitolite-receive-pack
"$@"