From: Karl Hasselström Date: Fri, 7 Apr 2006 06:06:09 +0000 (+0200) Subject: git-svnimport: Don't assume that copied files haven't changed X-Git-Tag: v1.3.0-rc3~1^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e67c66251a41653e3698580410121c9afc46cd1a;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/git-svnimport.perl b/git-svnimport.perl index 114784ff..4d5371ca 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -616,9 +616,7 @@ sub commit { } if(($action->[0] eq "A") || ($action->[0] eq "R")) { my $node_kind = node_kind($branch,$path,$revision); - if($action->[1]) { - copy_path($revision,$branch,$path,$action->[1],$action->[2],$node_kind,\@new,\@parents); - } elsif ($node_kind eq $SVN::Node::file) { + if ($node_kind eq $SVN::Node::file) { my $f = get_file($revision,$branch,$path); if ($f) { push(@new,$f) if $f; @@ -627,8 +625,15 @@ sub commit { print STDERR "$revision: $branch: could not fetch '$opath'\n"; } } elsif ($node_kind eq $SVN::Node::dir) { - get_ignore(\@new, \@old, $revision, - $branch,$path); + if($action->[1]) { + copy_path($revision, $branch, + $path, $action->[1], + $action->[2], $node_kind, + \@new, \@parents); + } else { + get_ignore(\@new, \@old, $revision, + $branch, $path); + } } } elsif ($action->[0] eq "D") { push(@old,$path);