I am using Subgit to import SVN repository to git, maintaining revision history.
Here is my svn repo structure:
Root trunk branches uat qua subfolder1 project1 subfolder2 project2 project3 ... projectn
I would like to import project1 and project2 into a single git repo but with changed folder names, project1newName and project2newName respectively.
Desired git repo structure should be as follows then:
Root project1newName project2newName
I have no idea how to achieve this through subgit import configuration.
I was trying something like this in subgit config file:
[svn]
trunk = branches/qua:refs/heads/master
includePath = /subfolder1/project1
includePath = /subfolder2/project2
After running subgit import and pushing translated git commits to bitbucket however:
- subfolder1 and subfolder2 are present in the git repo (I don't need them)
- project1 and project2 have their names unchanged
- git repo history includes commits that are unrelated to project1 and project2, eg those for project 3 (probably result of setting trunk to their common root - qua branch)
Is there any way to achieve my goals through subgit import itself? Some kind of smart mapping maybe I missed in the documentation?
It looks like you didn't miss anything in the documentation, the setup is correct and the use of
includePath
is also correct, but I'm afraid that the outcome of this setup is also correct and expected: theincludePath
setting (as well is its associateexcludePath
) is purposed to limit the number of imported directories and files. This feature, however, is not able to change paths and names on the fly, so it keeps the directories structure untouched, that's why thesubfolder
directories appear in Git. Same applies to names, SubGit does not renames directories on the fly -- it is possible to rename branches during the import, but not directories inside the branches. As for the empty commits -- this behavior may be changed by thetranslate. createEmptyGitCommits
setting:https://subgit.com/documentation/config-options.html#translate.createEmptyGitCommits