Skip to content

Instantly share code, notes, and snippets.

@thewestwind
Created February 7, 2015 01:26
Show Gist options
  • Save thewestwind/8523052e37cd6c5c3b80 to your computer and use it in GitHub Desktop.
Save thewestwind/8523052e37cd6c5c3b80 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
# This will create a bare Git repos "backed" by some Subversion
# subtree; uses the default trunk-tags-branches layout, for 1 user
# (line 51).
function usage {
echo "Usage: $(basename $0) <repos url> <repos.git>" 1>&2
exit -1
}
url="$1"; shift
repo="$1"; shift
okay=1
case "$url" in
svn://*)
;;
file://*)
;;
*)
unset okay
;;
esac
case "$repo" in
*.git)
;;
*)
echo "ERROR: $repo: by convention bare repositories shall be stored below *.git" 1>&2
unset okay
;;
esac
if [ "$okay" = 1 ]; then
if [ -e "$repo" ]; then
echo "ERROR: $repo: exists" 1>&2
usage
fi
else
usage
fi
set -e
subgit configure --svn-url "$url" "$repo"
cat > "$repo/subgit/authors.txt" <<EOF
david = David <[email protected]>
EOF
subgit install "$repo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment