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

前端 未结 5 1327
深忆病人
深忆病人 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 10:05

    [I realize this should be a comment on Jeff Fairley's answer but I don't have the reputation to post it as such. Since the original poster did ask for confirmation the approach worked I'm providing it as an answer.]

    I can confirm that his solution works for the problem he (and I) ran into caused by spaces in the path. I had the same requirements (clone a single module from an SVN repo with history) except that I had no branches or tags to worry about whatsoever.

    I tried several permutations of providing the full path to the module in the URL (e.g. using --no-minimise-url, specifying --trunk or --stdlayout) with no success. For me the result was usually a git repo with a full history log but no files whatsoever. This may or may not be the same problem FooF encountered (no read access in SVN) but it was certainly caused by having a space in the path to my module.

    Trying again with only the SVN repo base as the URL and the path to my module in --trunk worked flawlessly. Afterwards my .git/config looks like this:

    [core]
            repositoryformatversion = 0
            filemode = false
            bare = false
            loggallrefupdates = true
            symlinks = false
            ignorecase = true
            hideDotFiles = dotGitOnly
    [svn-remote "svn"]
            url = https://[url]/svn/[repo]
            fetch = trunk/[path-to-code]:refs/remotes/trunk
    [svn]
            authorsfile = ~/working/authors-transform.txt
    

    and subsequent git and git svn commands are throwing no errors at all. Thanks Jeff!

提交回复
热议问题