]> git.xonotic.org Git - xonotic/div0-gittools.git/blob - git-svn-checkout
oops, it's index, not work tree, here
[xonotic/div0-gittools.git] / git-svn-checkout
1 #!/bin/sh
2
3 set -ex
4
5 gitpath=$1
6 case "$gitpath" in
7         /*)
8                 ;;
9         *)
10                 gitpath="`pwd`/$gitpath"
11                 ;;
12 esac
13 shift
14
15 svnroot=$1
16 shift
17 svnpath=$1
18 shift
19
20
21 mkdir -p "$gitpath"
22 (
23         cd "$gitpath"
24         git init --bare
25         git --bare svn init "$@" "$svnroot"
26         case "$svnpath" in
27                 .)
28                         git --bare config svn-remote.svn.fetch "trunk:refs/remotes/trunk"
29                         git --bare config svn-remote.svn.branches "branches/*:refs/remotes/branches/*"
30                         git --bare config svn-remote.svn.tags "tags/*:refs/remotes/tags/*"
31                         ;;
32                 *)
33                         git --bare config svn-remote.svn.fetch "trunk/$svnpath:refs/remotes/trunk"
34                         git --bare config svn-remote.svn.branches "branches/*/$svnpath:refs/remotes/branches/*"
35                         git --bare config svn-remote.svn.tags "tags/*/$svnpath:refs/remotes/tags/*"
36                         ;;
37         esac
38         git --bare config remote.origin.url .
39         git --bare config       remote.origin.fetch "+refs/remotes/trunk:refs/heads/master"
40         git --bare config --add remote.origin.fetch "+refs/remotes/branches/*:refs/heads/*"
41         git --bare config --add remote.origin.fetch "+refs/remotes/tags/*:refs/tags/*"
42 )
43 git-svn-update "$gitpath"