Skip to content

Commit

Permalink
[backend] make tar diffing work for more cases
Browse files Browse the repository at this point in the history
We now always allow stripping of the first component if the
first entry is a directory.
  • Loading branch information
mlschroe committed Jun 4, 2018
1 parent 28475b9 commit 6c55ff0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/backend/BSSrcdiff.pm
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,12 @@ sub findtarfiles {
if (@names) {
# strip first dir if it is the same for all files
my $l1 = $names[0];
if ($l1 =~ s/\/.*//s) {
if ($l1 =~ s/\/.*//s || $files->[0]->{'type'} eq 'd') {
if (!grep {!($_ eq $l1 || $_ =~ /^\Q$l1\E\//)} @names) {
s/^[^\/]*\/?// for @names;
for (@names) {
s/^[^\/]*\/?//;
$_ = '.' if $_ eq '';
}
}
}
}
Expand Down

0 comments on commit 6c55ff0

Please sign in to comment.