git-svnimport: Don't assume that copied files haven't changed
Don't assume that a file that SVN claims was copied from somewhere else is bit-for-bit identical with its parent, since SVN allows changes to copied files before they are committed. Without this fix, such copy-modify-commit operations causes the imported file to lack the "modify" part -- that is, we get subtle data corruption. Signed-off-by: Karl Hasselström <kha@treskal.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Karl Hasselström committed
Apr 7, 2006 at 08:06 UTC
e67c66251a41653e3698580410121c9afc46cd1a
1 file changed
+10
-5
git-svnimport.perl
+10
-5
@@ -616,9 +616,7 @@ sub commit {
616
}
617
if(($action->[0] eq "A") || ($action->[0] eq "R")) {
618
my $node_kind = node_kind($branch,$path,$revision);
619
- if($action->[1]) {
620
- copy_path($revision,$branch,$path,$action->[1],$action->[2],$node_kind,\@new,\@parents);
621
- } elsif ($node_kind eq $SVN::Node::file) {
619
+ if ($node_kind eq $SVN::Node::file) {
620
my $f = get_file($revision,$branch,$path);
621
if ($f) {
622
push(@new,$f) if $f;
@@ -627,8 +625,15 @@ sub commit {
625
print STDERR "$revision: $branch: could not fetch '$opath'\n";
626
}
627
} elsif ($node_kind eq $SVN::Node::dir) {
630
- get_ignore(\@new, \@old, $revision,
631
- $branch,$path);
628
+ if($action->[1]) {
629
+ copy_path($revision, $branch,
630
+ $path, $action->[1],
631
+ $action->[2], $node_kind,
632
+ \@new, \@parents);
633
+ } else {
634
+ get_ignore(\@new, \@old, $revision,
635
+ $branch, $path);
636
+ }
637
}
638
} elsif ($action->[0] eq "D") {
639
push(@old,$path);