Skip to content

Commit

Permalink
[backend] BSSrcdiff: handle renamed files with no content change
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Nov 14, 2011
1 parent 28ab416 commit b658e66
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/backend/BSSrcdiff.pm
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,12 @@ sub datadiff {
} elsif ($old->{$of} ne $new->{$f}) {
if ($opts{'doarchive'} && $f =~ /\.(?:tgz|tar\.gz|tar\.bz2|tbz|tar\.xz)$/) {
my @r = tardiff("$pold/$old->{$of}-$of", "$pnew/$new->{$f}-$f", %opts);
if (@r == 0 && $f ne $of) {
# (almost) identical tars but renamed
my @os = stat("$pnew/$old->{$of}-$of");
my @s = stat("$pnew/$new->{$f}-$f");
push @changed, {'state' => 'renamed', 'old' => {'name' => $of, 'md5' => $old->{$of}, 'size' => $os[7]}, 'new' => {'name' => $f, 'md5' => $new->{$f}, 'size' => $s[7]}};
}
if (@r == 1 && !$r[0]->{'old'} && !$r[0]->{'new'}) {
# tardiff was too big
my @os = stat("$pnew/$old->{$of}-$of");
Expand All @@ -676,6 +682,10 @@ sub datadiff {
delete $r->{'state'};
push @changed, {'state' => 'changed', 'diff' => $r, 'old' => {'name' => $of, 'md5' => $old->{$of}, 'size' => $os[7]}, 'new' => {'name' => $f, 'md5' => $new->{$f}, 'size' => $s[7]}};
}
} else {
my @os = stat("$pnew/$old->{$of}-$of");
my @s = stat("$pnew/$new->{$f}-$f");
push @changed, {'state' => 'renamed', 'old' => {'name' => $of, 'md5' => $old->{$of}, 'size' => $os[7]}, 'new' => {'name' => $f, 'md5' => $new->{$f}, 'size' => $s[7]}};
}
}
for my $of (grep {!$done{$_}} sort(keys %$old)) {
Expand Down

0 comments on commit b658e66

Please sign in to comment.