简体   繁体   中英

How can I use git-svn to work with disparate parts of an svn repository?

I've got the following svn repository structure:

branches
    branch-1
    branch-2
trunk
    system-a
        component-0
        component-1
    system-b*
        component-0
        component-1*
    shared*
    site_scons*
    SConscript*

I have a team that needs to develop component-1 of system-b but they need to use git locally since they don't have direct access to our svn server. git-svn appears to be just what I'm looking for, as it allows me to create their git repo and manage the synchronization via git svn dcommit and git svn rebase .

I can easily replicate the entire svn repo for them with git svn clone https://svn-repo , but this will also give them everything under system-a as well as everything other than component-1 under system-b . There's several reasons not to do this, least of which is that it's not sensible to replicate (and track changes on) vast amounts of the repository that don't affect the system-b/component-1 team.

The starred directories shown above are the only ones they really need to get updates from and make changes to. It would also be great to make it impossible for them to accidentally make changes to things they don't need to access.

How can I accomplish this with git-svn ? I was thinking I could create a few separate git repos, a la:

git svn clone https://svn-repo/trunk/SConscript
git svn clone https://svn-repo/trunk/site-scons
git svn clone https://svn-repo/trunk/system-b/component-1
git svn clone https://svn-repo/trunk/shared

But this looks and sounds like it will be a headache for the git team since, to my understanding, this creates four actually distinct git repositories. Is there a way to have this 'sparse checkout' structure within a single git repo using git-svn ?

Sure, let me quote the man page for you

--include-paths=<regex>

This allows one to specify a Perl regular expression that will cause the inclusion of only matching paths from checkout from SVN. The --include-paths option should match for every fetch (including automatic fetches due to clone , dcommit , rebase , etc) on a given repository. --ignore-paths takes precedence over --include-paths.

config key: svn-remote.<name>.include-paths

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM