git svn importing a branch with a trailing space
The import’s been running for a while and has fetched the first 4000 revisions without incident. However, it now seems to have come across a branch name with a trailing space and it has fallen over.
$ git svn fetch Found possible branch point: https://10.10.10.2/svn/project/trunk => https://10.10.10.2/svn/project/branches/Release%2020110929%20, 3976 Found branch parent: (refs/remotes/Release 20110929 ) 691fb7f7d11cbb1afe35106f60a1d117ba415f4c fatal: Unable to create 'd:/GitMigration/project/.git/svn/refs/remotes/Release 20110929 /index.lock': No such file or directory read-tree 691fb7f7d11cbb1afe35106f60a1d117ba415f4c: command returned error: 128
This branch doesn’t exist any more so I can’t change the name in the normal way. The directory exists without the trailing space in the name but I can’t find a way to rename it that preserves the space.
Is there anything I can do about this?
3 Solutions collect form web for “git svn importing a branch with a trailing space”
The root cause of the issue – GIT creates a directory with a trailing space but in fact its name is truncated. For example Windows mkdir likes to do that. GIT doesn’t expect that and continues to use name with a space and fails to find a dir.
It can be fixed manually. Use FAR, GnuWin or any other tool which can make a directory with a trailing space. Then rename “d:/GitMigration/project/.git/svn/refs/remotes/Release 20110929” to “d:/GitMigration/project/.git/svn/refs/remotes/Release 20110929”. As you can see that’s the directory GIT was expecting to find.
git svn fetch again.
In the end I gave up on importing this in Windows. There are hacky solutions out there I’m sure, but it’s much easier just to do this in Linux then pull it from there to Windows. This should work fine as long as the branch isn’t current.
There is a manual workaround this issue. Try creating the the DIR manually.
To avoid trimming of white trailing white space you can add “\?\ at the beginning of the path” in cmd command. e.g.
mkdir "\\?\d:\GitMigration\project\.git\svn\refs\remotes\Release 20110929 "