git svn - clone repo with all externals

后端 未结 3 1969
傲寒
傲寒 2021-02-08 02:12

I want to use git to clone a svn repository, but unfortunately, where svn checkout gets the repo with all externals, git svn clone only gets the reposi

3条回答
  •  没有蜡笔的小新
    2021-02-08 02:23

    I have been use git as a front end to access a SVN repository. The structure in SVN is generally pretty simple such that there is top level directory which has the externals in it and no externals in sub-directories. Also the externals don't really change much once they are added in. So assuming something like:

    git svn clone X
    cd X
    

    I have had success getting all the externals with the following command:

    git svn show-externals | \
     perl -ne 'if (/^\/(.*) (.*)/) { print "git svn clone $1 $2\n"; }' | \
     bash
    

    I guess a more complicated structure for externals would require a more complicated perl script. Also, if your externals change you will need to do something similar again.

提交回复
热议问题