#!/bin/sh

set -e

trap "echo 'Brought to you by' ; git --version" EXIT

s=/tmp/svn-repos
g=/tmp/imported.git
w=/tmp/svn-wc

rm -rf $s $g $w

# Create a repository with a little bit of history.
svnadmin create $s
svn co file://$s $w
cd $w
mkdir trunk branches tags
svn add *
svn ci -m "Initial directory layout"

(
    cd trunk
    touch fabulous
    svn add fabulous
    svn ci -m "It's nice to have files in one's trunk."
)

# Make some structure in the svn repo that will confuse git-svn.
svn mkdir branches/fred
svn ci -m "A branch!"

svn rm branches/fred
svn ci -m "Oops, I didn't mean to create an empty directory!"

svn cp -r2 trunk branches/fred
svn ci -m "OK, now _that's_ how we make branches here in Texas."

# Now convert the svn repo to git ... and watch the carnage.
git svn clone -T trunk -b branches file://$s $g
