#! /bin/sh if [ -z "$1" ]; then echo "Usage: $0 svn_url [dir]" >&2 exit 1 fi url="$1" if [ ! -f authors.txt ]; then echo "Run \"get-authors $1\" first" >&2 exit 2 fi if [ -z "$2" ]; then dir="`basename $url`" else dir="$2" fi if [ -z "$dir" ]; then echo "Usage: $0 svn_url [dir]" >&2 exit 1 fi # init + fetch git svn clone "$url" --authors-file=authors.txt --stdlayout "$dir" && cd "$dir" && # fix references cp -rf .git/refs/remotes/tags/* .git/refs/tags/ && rm -rf .git/refs/remotes/tags cp -rf .git/refs/remotes/* .git/refs/heads/ && rm -rf .git/refs/remotes # convert svn:ignore to .gitignore git svn create-ignore && git commit -m "Add .gitignore" && # preserve authors.txt cp -p ../authors.txt .git/info && git config --local --path svn.authorsfile .git/info/authors.txt git svn gc && git gc --aggressive && echo "Cloned from $url using git-svn" >.git/description && exec "${VISUAL:-${EDITOR:-vi}}" .git/description