joe
joe

Reputation: 81

How do I change ignore-paths on an existing git-svn repo?

I have an already existing git-svn repo with an ignore paths in my .config file that looks like this:

ignore-paths = ^(?!(Path1/Proj1|Path1/Proj2|Path2/Proj3))

This works well.

Someone added a new project in svn that I now need in my git repo.

If I change ignore-paths to what's below and issue a fetch or a rebase, I never see Path2/Proj4

 ignore-paths = ^(?!(Path1/Proj1|Path1/Proj2|Path2/Proj3|Path2/Proj4))

In the past, I've always given up and blasted away my git repo and recreated it. Is there a better way?

Upvotes: 8

Views: 1011

Answers (1)

npostavs
npostavs

Reputation: 5027

After editing the ignore-paths you need to

git svn reset -r <n> -p # where <n> is the SVN revision where the new path was added.
git svn fetch
git rebase # or reset

Reference git-svn(1):

reset

Undoes the effects of fetch back to the specified revision. This allows you to re-fetch an SVN revision. Normally the contents of an SVN revision should never change and reset should not be necessary. However, if SVN permissions change, or if you alter your --ignore-paths option, a fetch may fail with "not found in commit" (file not previously visible) or "checksum mismatch" (missed a modification). If the problem file cannot be ignored forever (with --ignore-paths) the only way to repair the repo is to use reset.

Only the rev_map and refs/remotes/git-svn are changed (see $GIT_DIR/svn/*\*/.rev_map.* in the FILES section below for details). Follow reset with a fetch and then git reset or git rebase to move local branches onto the new tree.

Upvotes: 2

Related Questions