Remove trailing slashes
authorMatthias Urlichs <smurf@smurf.noris.de>
Mon, 14 Nov 2005 07:31:00 +0000 (08:31 +0100)
committerMatthias Urlichs <smurf@smurf.noris.de>
Mon, 14 Nov 2005 07:31:00 +0000 (08:31 +0100)
SVN dies a messy death when passed a path with trailing slashes.

git-svnimport.perl

index cb9afb9..af13fdd 100755 (executable)
@@ -280,7 +280,8 @@ sub revert_split_path($$) {
                $svnpath = "$branch_name/$branch/$path";
        }
 
-       return $svnpath
+       $svnpath =~ s#/+$##;
+       return $svnpath;
 }
 
 sub get_file($$$) {
@@ -372,6 +373,10 @@ sub copy_path($$$$$$$$) {
        my($newrev,$newbranch,$path,$oldpath,$rev,$node_kind,$new,$parents) = @_;
 
        my($srcbranch,$srcpath) = split_path($rev,$oldpath);
+       unless(defined $srcbranch) {
+               print "Path not found when copying from $oldpath @ $rev\n";
+               return;
+       }
        my $therev = branch_rev($srcbranch, $rev);
        my $gitrev = $branches{$srcbranch}{$therev};
        unless($gitrev) {