问题
I hope anybody can help me.
When I try to push my local git branch to the svn server this will always result into this error:
$ git svn dcommit
Committing to http://.../Dev_Stream/01_workspace ...
C path/to/file/AbstractSystemThread.java => other/path/to/file/Thread/AbstractThread.java
assertion "svn_fspath__is_canonical(child_fspath)" failed: file "/usr/src/subversion/subversion-1.8.0-1/src/subversion-1.8.0/subversion/libsvn_subr/dirent_uri.c", line 2502, function: svn_fspath__skip_ancestor
Preconditions:
- clean local git repository (no staged or unstaged changes)
- called git svn rebase before
Cygwin installation contains these packages:
- git, git-svn 1.7.9-1
- subversion, subversion-perl 1.8.0-1
When searching for this problem in the internet, I found several errors like this where a path could not be canonicalized. But I did not find a solution for exactly this problem.
Has anybody an idea how to solve it? Is any information missing?
回答1:
I also had this problem (git version 1.8.3) and solved it by downgrading subversion to 1.7.9 (from 1.8.0).
回答2:
If you cannot downgrade to SVN 1.7.X, another option is doing the Git-SVN commit this way:
git svn dcommit -C1 -l1
This basically turns off Git rename detection (so it is a workaround, not a fix). You will lose rename track information (a rename will be committed as a delete followed by a new file, like SVN 1.4). But the commit will work.
Edit In spite of some comments here, I believe this will work with the current Git version on the Cygwin repository (1.7.9.1). If some day that changes, I'll update my answer accordingly.
In fact, let's hope the situation improves to the point that we won't need any fix or workaround, and Git-SVN just works (as it used to). :-)
回答3:
An easy way to install patched version of git-svn from github:
Find the buggy script:
find /usr -name Editor.pm
Replace it with patched version:
cd /usr/lib/perl5/vendor_perl/5.18.1/Git/SVN mv Editor.pm Editor.pm.bak wget https://raw.github.com/git/git/2394e94e831991348688831a384b088a424c7ace/perl/Git/SVN/Editor.pm
回答4:
I've managed how to solve this problem w/o downgrading svn. Error msg was like this:
git svn dcommit
Committing to http://...
C File1.hpp => File2.hpp
ERROR from SVN:
RA layer request failed: PUT request on '...File2.hpp' failed: 409 Conflict...
then I've rebased just before this commit, removed File1.hpp, made new commit and in next one just added File2.hpp like a new one. After this git svn dcommit wasn't complaining anymore.
回答5:
Downgrading svn is not guaranteed to help: the bug is in serf backend so one has to also make sure to switch to neon backend.
The bug has been patched in svn upstream: http://thread.gmane.org/gmane.comp.version-control.subversion.devel/145186.
There's a workaround submitted to git upstream: http://thread.gmane.org/gmane.comp.version-control.git/237906/focus=239690. As it's in perl you can apply it locally to your installed version, before any of the above is released and propagates to your environment.
回答6:
I have experienced the same on OSX with fink, and solved it by downgrading svn and the perl swig svn bindings to 1.7.11 from 1.8 (and afterwards rebuilding, just in case, git-svn).
The problem appeared on renames, and happened both on server 1.6.12 and 1.7.9, via dav_svn, on a 1.6 format repository (I am unsure if it happens with svn+ssh as well).
git-svn is on version 1.8.3.3, which was a requirement in my case (as only git-svn >= 1.7.7 can merge svn-tracked branches, see here).
回答7:
I struggled with the accepted answer. I just felt like the accepted answers tells you what to do but not how to do it. I found it much easier to upgrade to the master version of git than downgrade subversion in cygwin. Keep in mind either one will fix the issue. I've documented how to build the master version of git here: How do I build and use the latest version of git on cygwin?
回答8:
I had the same problem and solved it by reverting to git-svn 1.7.5.1 (svn 1.7.10).
Not sure but I think the problem is that the repository was cloned with the previous version of svn (1.7.xxx) and for some reason the new version (1.8.0) cannot handle it correctly.
回答9:
diff -u /usr/local/lib/perl5/site_perl/5.16/Git/SVN/Editor.pm.bak /usr/local/lib/perl5/site_perl/5.16/Git/SVN/Editor.pm
--- /usr/local/lib/perl5/site_perl/5.16/Git/SVN/Editor.pm.bak 2014-01-20 15:52:54.000000000 +0100
+++ /usr/local/lib/perl5/site_perl/5.16/Git/SVN/Editor.pm 2014-01-20 15:55:16.000000000 +0100
@@ -304,8 +304,9 @@
my ($self, $m, $deletions) = @_;
my ($dir, $file) = split_path($m->{file_b});
my $pbat = $self->ensure_path($dir, $deletions);
+ my $upa= $self->url_path($m->{file_a});
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
- $self->url_path($m->{file_a}), $self->{r});
+ $upa, $self->{r});
print "\tC\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
$self->chg_file($fbat, $m);
$self->close_file($fbat,undef,$self->{pool});
@@ -323,8 +324,9 @@
my ($self, $m, $deletions) = @_;
my ($dir, $file) = split_path($m->{file_b});
my $pbat = $self->ensure_path($dir, $deletions);
+ my $upa= $self->url_path($m->{file_a});
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
- $self->url_path($m->{file_a}), $self->{r});
+ $upa, $self->{r});
print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
$self->apply_autoprops($file, $fbat);
$self->chg_file($fbat, $m);
来源:https://stackoverflow.com/questions/17693255/git-svn-dcommit-fails-because-of-assertion-error-svn-fspath-is-canonicalchild