Skip to content

Commit

Permalink
SVN::Record with no property block should not emit Prop-content-lengt…
Browse files Browse the repository at this point in the history
…h:0 header

Fixes RT #64066, by Roderich Schupp <rschupp@cpan.org>

https://rt.cpan.org/Ticket/Display.html?id=64066
  • Loading branch information
book committed Feb 19, 2011
1 parent fa9934e commit ece3469
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/SVN/Dump/Record.pm
Expand Up @@ -87,7 +87,8 @@ sub update_headers {

$self->set_header( 'Text-content-length' => $textlen )
if defined $self->get_text_block();
$self->set_header( 'Prop-content-length', $proplen );
$self->set_header( 'Prop-content-length', $proplen )
if $proplen;
$self->set_header( 'Content-length' => $proplen + $textlen );
}

Expand Down
11 changes: 10 additions & 1 deletion t/13record.t
Expand Up @@ -5,7 +5,7 @@ use t::Utils;

use SVN::Dump::Record;

plan tests => 29;
plan tests => 30;

# the record object
my $rec = SVN::Dump::Record->new();
Expand Down Expand Up @@ -92,3 +92,12 @@ is( $scalar, 22, '$scalar is 22 (perldoc -f delete)' );
my @array = $rec->delete_property(qw(foo bar baz));
is_deeply( \@array, [ undef, undef, 33 ], '@array is (undef, undef,33)' );

# test a record without properties
$rec = SVN::Dump::Record->new;
$rec->set_header( "Node-path", "trunk/fubar.txt" );
$rec->set_header( "Node-kind", "file" );
$rec->set_header( "Node-action", "change" );
$rec->set_text("some text");
ok( $rec->as_string !~ /^Prop-content-length: 0$/m,
"No Prop-content-length: 0" );

0 comments on commit ece3469

Please sign in to comment.