mv module/.git to module.git and configure repository for git daemon
[infrastructure.git] / scripts / git-clone.sh
1 #!/bin/bash
2
3 # uses svn2git ruby script
4 # install rubygems 
5 # sudo gem install svn2git --source http://gemcutter.org
6
7 #http provides really crappy performance....
8 #SVNROOT="http://svn.planet-lab.org/svn"
9 # so run locally at princeton
10 SVNROOT="file:///svn"
11
12 function clone () {
13     for arg in "$@" ; do
14         SVN_MODULE=$(basename $arg)
15         echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx converting module $SVN_MODULE in $(pwd)"
16         SVN_PATH=${SVNROOT}/${SVN_MODULE}
17         GIT_WORKDIR=$(echo $SVN_MODULE | sed 's/.*/\L&/')
18         GIT_REPO=${GIT_WORKDIR}.git
19
20         rm -rf $GIT_WORKDIR
21         rm -rf $GIT_REPO
22
23         mkdir -p $GIT_WORKDIR
24         pushd $GIT_WORKDIR
25         svn2git $SVN_PATH
26         popd
27
28         mv ${GIT_WORKDIR}/.git ${GIT_REPO}
29         rm -rf ${GIT_WORKDIR}
30
31         pushd $GIT_REPO
32         # enable clone with git:// protocol
33         # git-config daemon.uploadpack true
34
35         # enable archive with git:// procotol
36         git-config daemon.uploadarchive true
37         popd
38
39     done
40 }
41
42 args="$@"
43 [[ -z "$args" ]] && args=$(ls /svn)
44
45 clone $args