Work-around for failing “git svn clone” (requiring full history)

前端 未结 5 1366
深忆病人
深忆病人 2021-01-31 09:47

I want to convert a Subversion repository sub-directory (denoted by module here) into a git repository with full history. There are many svn copy opera

5条回答
  •  没有蜡笔的小新
    2021-01-31 09:56

    I recently migrated a long list of SVN repositories into Git and towards the end ran into this problem. Our SVN structure was pretty sloppy, so I had to use --no-minimize-url quite a bit. Typically, I'd run a command like:

    $ git svn clone http://[url]/svn/[repo]/[path-to-code] \
                -s --no-minimize-url \
                -A authors.txt
    

    The last few migrations I ran had a space in the URL. I don't know if it was the space or something else, but I was getting the same error you were seeing. I didn't want to get into modifying config files if I didn't have to, and luckily I ended up finding a solution. I ended up skipping the -s --no-minimize-url options in favor of explicitly declaring the paths differently.

    $ git svn clone http://[url]/svn/[repo]/ \
                --trunk="/[path-to-code]/trunk" \
                --branches="/[path-to-code]/branches" \
                --tags="/[path-to-code]/tags" \
                -A authors.txt \
                --follow-parent
    
    • Note that I added --follow-parent from your example, but I'm also not sure that it made any difference.
    • Remember that these repos had spaces in them, hence the "" around the trunk/branches/tags paths.

提交回复
热议问题