Skip to content

Commit

Permalink
git-svnimport: Don't assume that copied files haven't changed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Karl Hasselström authored and Junio C Hamano committed Apr 7, 2006
1 parent 9760662 commit e67c662
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions git-svnimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit e67c662

Please sign in to comment.