How to setup a browseable source code repository in minutes.
What I needed, was actually very simple: a read-only checkout of a selected set of repositories, which are constantly updated and therefore browse-able.
I first tried tailor and … failed. The documentation is not very extensive and if you try to solve an authentication issue with three components involved (ssh, tailor and git) you’re burning time.
I thought a better way is possibly by using git-svn. I wrote a little bash script, which clones a list of source code repositories and updates them constantly. Because the whole thing took me about an hour to setup, I thought it would be prudent to share the little piece of code with the outside world. Maybe someone feels lucky and needs something similar:#!/bin/bash
# the directory in which all repositories are mirrored
ROOT=$HOME/repos
SCRIPTROOT=$HOME/bin
# repository urls
SVNROOT=svn://svn.urltoyourrepsitory.net/repo
GITROOT=ssh://git.urltoyourrepository.net/repo
# list seperated by newline with the names of all repositories
GITREPOSITORIES=`cat $SCRIPTROOT/gitrepositories`
REPOSITORIES=`cat $SCRIPTROOT/svnrepositories`
AUTHORSFILE=$SCRIPTROOT/svnauthors
rebase_only() {
if test -d $1; then
cd $1;
echo "Rebase in " `pwd`;
case $2 in
svn)
git svn rebase;
;;
*)
git pull --rebase;
esac
cd $ROOT;
fi;
}
cd $ROOT;
for repo in $REPOSITORIES; do
rebase_only $repo "svn";
if !(test -d $repo); then
echo "creating new repo" $repo
git svn clone -A$AUTHORSFILE $SVNROOT/$repo;
fi;
done;
for repo in $GITREPOSITORIES; do
tmp=${repo##*/};
reponame=${tmp%*.git};
rebase_only $reponame "git";
if !(test -d $reponame); then
echo "creating new git repo" $repo;
git clone $GITROOT/$repo;
fi;
done;

