Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn fetch/rebase failing after trying to repair a corrupted file

Tags:

git

git-svn

I recently had a corrupted object in my repository, pointing on my HEAD (the object was empty) . It happened after interrupting a git-svn command. Then, I restored my repository by changing manually the refs on this object.

Now, I want to synchronize my git repository with SVN, but git svn fetch returns:

fatal: Invalid revision range 5a5dc92cd3083960fb4828ae387a32cda0554fa8..refs/remotes/a-branch
rev-list --pretty=raw --no-color --reverse 5a5dc92cd3083960fb4828ae387a32cda0554fa8..refs/remotes/a-branch --: command returned error: 128

5a5dc92cd3083960fb4828ae387a32cda0554fa8 refers to the corrupted object, I would like to say git-svn not to consider this object but another one, but I do not know how to hack this.

If anyone knows where/how git-svn internally stores this value it would be great.

Thank you

like image 280
Goug Avatar asked Jul 19 '10 15:07

Goug


1 Answers

if you have svn metadata stored with your commit messages (those http://svn.…./svn/trunk@r12331 (<id>)), you can delete the .rev_map.<id> files from the .git/svn/… directories.

git-svn will then re-create them before running the next command.

Edit: When running git gc if you see output along the lines of:

$ git gc
warning: reflog of 'HEAD' references pruned commits
warning: reflog of 'refs/heads/master' references pruned commits
warning: reflog of 'refs/remotes/trunk' references pruned commits

Then you know that you need to perform the above trick. In this case:

rm .git/svn/refs/remotes/trunk/.rev_map.*
like image 138
knittl Avatar answered Oct 08 '22 03:10

knittl