I’ve been recently working with git-svn and I came across a frustrating scenario in which I’m hit with the same code conflicts over and over again. The recipe is the following
- Do a git-svn clone of an svn repository.
- Make a git svn clone of it, let’s call it repo1 (it’s a git repository).
- Make a git clone of repo1, let’s call it repo2.
- Do a native svn checkout of the svn repository, make a change to a file and commit it.
- In repo2, make a conflicting change to the same file and commit it.
- Pull the change from repo2 to repo1.
- In repo1, do a git svn rebase. It will fail with a code conflict. Resolve the conflict and run git svn dcommit.
- Pull changes from repo1 to repo2. It will fail with a code conflict. Resolve the conflict.
- So far so good. All conflicts are resolved.
- In repo2, make an unrelated change to the same file in which the conflict has previously occurred.
- Pull the change from repo2 to repo1.
- Do a git svn dcommit.
In my experience, the last git svn dcommit fails with a code conflict – the same that initially occurred. Moreover, even if I resolve this conflict and dcommit my new change, any subsequent changes to that file will result in the same code conflicts cropping up again and again.
I’ve written a script which reproduces the issue for anyone who would like to examine it and/or propose a recovery procedure, a fix or a workaround.
Advertisement
2011-01-06 at 12:08 |
Does git rerere help (second time around)?
2011-01-09 at 21:07 |
I tried to use it, but it might be because I don’t know how to use it yet.
From what I’ve read so far and talked to people on #git, it’s essentially a case of recovering from an upstream rebase. The solution is to use git rebase –onto, with the right parameters. I didn’t find the right parameters so far.
I also read that pulls, pushes and merges from remote repositories are not supported by git-svn. You can check out a svn repository to git, but you can’t further clone it and merge changes across your new git repos.
2011-03-09 at 15:10 |
If you are having trouble resolving a conflict check this out: http://www.duchnik.com/tutorials/vc/svn-conflicts
2011-03-18 at 09:57 |
The problem is not about resolving one conflict. It’s about a situation in which the way git-svn bindings are done causes the same code conflict to reoccur. For example, when somebody else commits to svn, and I call “git svn rebase”, a previously resolved code conflict reoccurs, even though I haven’t edited any files.
2011-03-28 at 10:57 |
[...] If you use git pull/push and try to commit back to subversion, you will sooner or later fall into the trap that I fell into some time ago. I’ve since worked out a relatively sane workflow which allows me to work [...]