-1

I have a large svn repository and im trying to migrate to git. Now im struggling using --ignore-paths with git-svn to filter some paths.

I have this repository: https://svn.host.co.mz/svn/sistemas Then i have a project named project1 and inside project1 i have two branches. Inside development i have a directory named archive, dev_demo and sprints.

project1

  • branches/
    • development
    • production

project2

  • branches/
    • development -archive -sprints -dev_demo
    • production

I want to clone and fetch only sprints and dev_demo inside development but it always comes with archive path.

I have tried to implement the below .git/config but it´s not working.

       
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true

[svn-remote "svn"]
    url = https://svn.host.co.mz/svn/sistemas/project1
    fetch = :refs/remotes/origin/project1
    ignore-paths = ^branches/development/(archive|[^/]*/archive)/

I want a regex that matches with the structure of my paths and exlude archive directory.

1
  • Why don't you simply put ^branches/development/archive?
    – tripleee
    Commented Aug 12, 2024 at 10:08

1 Answer 1

0

If the svn repo contains "too much stuff" but you know exactly what you need — let me suggest changing the approach from a "subtractive" to an "additive" one. Should be way cleaner & easier to understand.

What I mean is, instead of trying to filter out junk with ignores, just map out what you need explicitly:

[svn-remote "svn"]
    # NOTE: it should point to svn repo root, ↓↓↓ no /project1 here
    url = https://svn.host.co.mz/svn/sistemas
    #                                         ↑↑↑

    branches = project1/{development,production}:refs/remotes/project1/branches/*

    fetch = project2/production:refs/remotes/project2/branches/production

    fetch = project2/dev-demo:refs/remotes/project2/branches/development/dev_demo

    branches = project2/sprints/*:refs/remotes/project2/branches/development/sprints/*

The docs --> https://git-scm.com/docs/git-svn <--

It is also possible to fetch a subset of branches or tags by using a comma-separated list of names within braces

Multiple fetch, branches, and tags keys are supported

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.