Home > Software design >  Subgit: Pattern is not empty and doesn't have format segment1/segment2/.../segmentN
Subgit: Pattern is not empty and doesn't have format segment1/segment2/.../segmentN

Time:03-22

I am trying to convert a Subversion repository to Git using subgit. The SVN structure is roughly as follows:

trunk
├── Projects
│   ├── Project1
│   │   └── src
│   ├── Project2
│   └── Project3
├── SomeOtherDir
└── YetAnotherDir
branches
├── Projects
│   ├── Project1
│   │   ├── Branch_1
│   │   │   └── src
│   │   └── Branch_2
│   ├── Project2
│   └── Project3
├── SomeOtherDir
└── YetAnotherDir
tags
... similar to branches structure

As all of this is old code and I don't want to split it into multiple small repositories, my idea was to set the mapping in the subgit config file like this:

trunk = trunk:refs/heads/master
branches = branches/Projects/Project1/Branch_1:refs/heads/Project1_Branch_1

This worked for other repos and it seems to work on some branches here, however with other branches I get the following error:

SubGit version 3.3.12 ('Bobique') build #4419

IMPORT FAILED

error: Failed to load Subversion configuration at '/path/to/subgit/config'
error: Invalid layout option 'svn.branches': Pattern "/refs/heads/Project1_Branch_1" is not empty and doesn't have format segment1/segment2/.../segmentN.

I don't really understand what the error means or how to fix it. Any ideas or suggestions would be much appreciated. Thanks!

CodePudding user response:

the first this that looks incorrect as for me is that the error message mentions pattern that begins with "/":

Pattern "/refs/heads/Project1_Branch_1"

such mapping is incorrect and would lead to that exact "Invalid layout option" error, so I suppose the real mapping in the repository may indeed set like this:

branches = branches/Projects/Project1/Branch_1:/refs/heads/Project1_Branch_1

in this case, the leading slash should be removed to resolve the issue.

Another possible reason is the branch name, if it contains some unexpected symbols, like ";", ":", or other, that may also lead to errors like this one.

  • Related