diff --git a/lib/SVN/Dump/Record.pm b/lib/SVN/Dump/Record.pm index 7fc665b..2036832 100644 --- a/lib/SVN/Dump/Record.pm +++ b/lib/SVN/Dump/Record.pm @@ -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 ); } diff --git a/t/13record.t b/t/13record.t index 91af06a..ff0384e 100644 --- a/t/13record.t +++ b/t/13record.t @@ -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(); @@ -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" ); +