12

I am using git in a shop that is all Subversion. When I check out a repo using

git svn clone -s --preserve-empty-dirs https://<subversion-server>/svn/<repo> <folder-name>

All seems well as the cloning process begins, but at some point during the process, git fails with

Failed to strip path '<path-to-some-file>' ((?^:^trunk(/|$)))

Anyone know what's wrong or how to fix this?

1
  • 2
    I found that re-running the git svn clone command seems to be a valid workaround when using git 2.7.3. It seems that git will continue just where it left off, similarly on network connection failures during git svn clone. Commented Mar 18, 2016 at 10:10

1 Answer 1

12

Searching the interwebs turned up both an explanation and advice on how to fix this (see step 4).

Note:

From v1.7.7 onward, Git has a --preserve-empty-dirs. Problem is, the damn thing's broken. If you try to use it as-is, the whole operation will likely just fail partway through. It has to be fixed.

But the advice may be dated, as it did not work for my installation (git 2.7.0). But now knowing the issue, I was able to find the offending line and apply the suggested fix:

The fix was made by changing the offending line in usr/lib/perl5/vendor_perl/5.22/Git/SVN/Fetcher.pm, line 163:

Change die "Failed to strip path... to print "Failed to strip path... and all will be well.

I hope that helps someone else out there as well.

Sign up to request clarification or add additional context in comments.

2 Comments

Performed the change from die to print. Ran this w/o option --no-metadata and was successful. Also ran the git svn process (with --no-metadata) and it continued to produce a remote repository. However the clone command output "done" and this, "warning: remote HEAD refers to nonexistent ref, unable to checkout." I was not able to locate a commit or any data in that clone. The underlying problem is not really explained. I recommend to restore the original 'die' command. When automating and running multiple conversions this could mask a problem that may only manifest when Murphy's Law applies.
that worked for me in a jenkins container at path /usr/share/perl5/Git/SVN/Fetcher.pm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.