aboutsummaryrefslogtreecommitdiffstats
path: root/Perl
diff options
context:
space:
mode:
authorDenis Barbier <barbier>2001-11-19 00:28:34 +0000
committerDenis Barbier <barbier>2001-11-19 00:28:34 +0000
commitfe3bdc0a9a02eb37cc2447631a37d6db800f995d (patch)
tree6b0eef407fa8f6cc2adf6b588dd98b49f352e124 /Perl
parenta3b20376071fc8c298ca5b3f957551bb648ff0aa (diff)
Files created by a patch could not be stored on disk, and first line
was also missing from text. CVS version numbers Perl/Local/Inside/Diff.pm: 1.1 -> 1.2 Perl/Local/Inside/Tar.pm: 1.1 -> 1.2
Diffstat (limited to 'Perl')
-rw-r--r--Perl/Local/Inside/Diff.pm1
-rw-r--r--Perl/Local/Inside/Tar.pm17
2 files changed, 13 insertions, 5 deletions
diff --git a/Perl/Local/Inside/Diff.pm b/Perl/Local/Inside/Diff.pm
index 54debd94a73..74da4056491 100644
--- a/Perl/Local/Inside/Diff.pm
+++ b/Perl/Local/Inside/Diff.pm
@@ -550,7 +550,6 @@ sub apply_patch {
Carp::carp "In ".__PACKAGE__."::apply_patch, patch new file with non-empty text"
if $text ne '';
$text = $self->{data}->{files}->{$name}->{patch_list}->[0]->{data};
- $text =~ s/^[^\n]+\n//s;
$text =~ s/^\+//mg;
return $text;
} else {
diff --git a/Perl/Local/Inside/Tar.pm b/Perl/Local/Inside/Tar.pm
index 5a98fdb6d4e..00f3aa608b1 100644
--- a/Perl/Local/Inside/Tar.pm
+++ b/Perl/Local/Inside/Tar.pm
@@ -447,13 +447,22 @@ sub _parse_cache {
$self->_debug("Checking in memory representation");
$self->_io_open();
- foreach $name (sort {$self->{data}->{files}->{$a}->{offset} <=> $self->{data}->{files}->{$b}->{offset}} @{$self->{data}->{list_files}}) {
+ foreach $name (@{$self->{data}->{list_files}}) {
$maxlength = &$matchfiles($name) || 0;
$path = '';
if ($maxlength =~ s/^://) {
$path = $maxlength;
- next if -r $path;
- $maxlength = -1;
+ unless (-r $path) {
+ my $dir = File::Basename::dirname($path);
+ File::Path::mkpath($dir, 0, 0755);
+ open(DISK, "> ".$path)
+ || warn "Unable to write to $path\n";
+ print DISK $self->{data}->{files}->{$name}->{data};
+ close(DISK);
+ $self->{data}->{files}->{$name}->{data} = '';
+ $self->{data}->{files}->{$name}->{read} = 0;
+ next;
+ }
} elsif ($maxlength !~ m/^-?[0-9]+$/) {
$maxlength = 0;
}
@@ -728,7 +737,6 @@ sub bind_patch {
foreach ($self->{patch}->list_new_files()) {
$self->_debug("New file added to archive: $_");
my $data = $self->{patch}->{data}->{files}->{$_}->{data};
- $data =~ s/^[^\n]*\n//s;
$data =~ s/^\+//mg;
$self->{data}->{files}->{$_} = {
offset => -1,
@@ -739,6 +747,7 @@ sub bind_patch {
dchars => length($data),
patch => 1,
};
+ push (@{$self->{data}->{list_files}}, $_);
}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy