index.lock invalid argument

Viewed 860

I am trying to convert a svn repo to Git. I've done the standard Git svn clone <url> however it stops around a certain point.

These are the commands I ran:

java -jar ../svn-migration-scripts.jar authors <svn-repo-url> > authors.txt
mkdir repo && cd repo
git svn init --prefix="" --stdlayout <svn-repo-url> 
git config svn.authorsfile <authors.txt path>
git svn fetch

The error that comes out is:

fatal: Unable to create 'C:/Users/user1/migrate/proj1/.git\svn\refs\remotes\https;C:\Program Files\Git\index.lock': 
Invalid argument write-tree: command returned error:128

I'm on Windows 10. I'm not understanding what the error is and how to fix it.

1 Answers

I had the same issue. The problem was that some SVN revisions were trying to create directories with colon characters in them. That is an invalid character in Windows filenames, and that is messing up the path handling code somewhere inside git-svn.

The solution is to clone the repo, but skipping the offending revision. For example if revisions 21 and 22 have invalid paths, first clone up to revision 20 and then fetch from revision 23 to the end :

git svn clone -s -r1:20 https://path.to/some/repo/ target_directory
cd target_directory
git svn fetch -r 23:HEAD

Or you can also first run git svn init and then run 2 separate fetch commands.

git-svn manages to bridge the gap and rebuilds the history over the missing revisions.

Related