开发者

How to fix "file not found" on git svn dcommit?

I'm trying to do git svn dcommit, however, one directory continues to fail on me and therefore stops my commit and continue to get this error:

Filesystem has no item: File not found: transaction '43999-6', path '/path/to/folder' at /usr/local/git/libexec/git-core/git-svn line 572

I tried adding the folder back in but i continue to get that error. can I remove a commit from the tree to bypass this? Not sure what else to do here.

edit

some of the following don't fully answer my question, but they seem to be in the right direction:

  • issue about tracking and not detaching the HEAD
  • issue about rebasing
  • issue about recovering commits

The last issue seems to be what I wanted, but with the size of my repo (last time, took me around a whole work day to checkout the entire thing), and the little amount of work I woul开发者_如何学God have lost by just doing a hard reset (which ultimately seemed to do the trick), I went for the hard reset option.


svn reset --hard didn't work for me

the reason of this is that when doing a dcommit to svn, it seems like the commit that deleted the file appears to be done in both git and svn at the same time but the link is lost.

The solution that worked for me was to reset master to the commit before the problem, then merge all sucessive commit back to master (except the faulty one), then redo the file deletion. there may be a more elegant solution...

side note: git svn DOES svn rename/move files correctly. It (either tortoisegit+mysgit or jgit/egit) does it automagically all the time ;)


I don't think git-svn actually supports renaming files. I get this error every time I try to rename something. I always end up having to rename it with svn and then rebase with git-svn.

Update

This is likely due to the fact that git-svn doesn't play nicely with spaces in URLs. I often have to rename project paths in order to get them to work with git-svn. Of course, this isn't an acceptable solution for projects that actually have other people working on them. For those I simply have to resort to using svn to move files. It's a huge hassle.


I was able to work around the problem of git svn not working for repositories with spaces in them by patching git-svn.

I updated the url_path function to:

sub url_path { 
  my ($self, $path) = @_; 

  my $url = $self->{url} . '/' . $self->repo_path($path); 
  if ($self->{url} =~ m#^https?://#) { 
    $url =~ s!([^~a-zA-Z0-9_./-])!uc sprintf("%%%02x",ord($1))!eg; 
    $url =~ s!^(https?)%3A//!$1://!; 
  } 
  $url 
} 

This ensures that the spaces in the url are encoded correctly.

It seems to work for me, but hasn't been tested thoroughly.


I believe the problem should be fixed in Git >= 1.8.0

You should consider to upgrade it.

Home page: https://github.com/git/git


I know this is an old question but I had this exact issue recently and wanted to share how I fixed the problem. Admittedly this is not a nice solution but it allowed me to complete my commit. I did the following:

  1. Added the folder/file under complaint back into svn using svn.
  2. Committed my original code from git to svn (git svn dcommit --rmdir)
  3. Deleted the folder/file in git and committed this to svn.

This meant I had an extra 2 small commits, one to add and then another to remove the offending folder/file but after this everything worked as expected again. I know this isn't a nice solution and it doesn't address the root of the problem but at least it allowed me to commit my code. Hopefully this can help someone else in this situation needing a quick fix.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜