@matheusbsbs / matheus-bagliano / commits / 8598db935b
Fork 0

git-svn: Send deltas during commits

Signed-off-by: Florian Weimer <fw@deneb.enyo.de> Acked-by: Eric Wong <normalperson@yhbt.net>

Florian Weimer committed Aug 31, 2008 at 17:47 UTC 8598db935b653c638109aecab3e345c45d53af07
1 file changed +13 -5
git-svn.perl
+13 -5
@@ -3691,12 +3691,20 @@ sub chg_file {
3691 } elsif ($m->{mode_b} !~ /755$/ && $m->{mode_a} =~ /755$/) {
3692 $self->change_file_prop($fbat,'svn:executable',undef);
3693 }
3694 - my ($fh, $exp) = _chg_file_get_blob $self, $fbat, $m, 'b';
3694 + my ($fh_a, $exp_a) = _chg_file_get_blob $self, $fbat, $m, 'a';
3695 + my ($fh_b, $exp_b) = _chg_file_get_blob $self, $fbat, $m, 'b';
3696 my $pool = SVN::Pool->new;
3696 - my $atd = $self->apply_textdelta($fbat, undef, $pool);
3697 - my $got = SVN::TxDelta::send_stream($fh, @$atd, $pool);
3698 - die "Checksum mismatch\nexpected: $exp\ngot: $got\n" if ($got ne $exp);
3699 - Git::temp_release($fh, 1);
3697 + my $atd = $self->apply_textdelta($fbat, $exp_a, $pool);
3698 + if (-s $fh_a) {
3699 + my $txstream = SVN::TxDelta::new ($fh_a, $fh_b, $pool);
3700 + SVN::TxDelta::send_txstream($txstream, @$atd, $pool);
3701 + } else {
3702 + my $got = SVN::TxDelta::send_stream($fh_b, @$atd, $pool);
3703 + die "Checksum mismatch\nexpected: $exp_b\ngot: $got\n"
3704 + if ($got ne $exp_b);
3705 + }
3706 + Git::temp_release($fh_b, 1);
3707 + Git::temp_release($fh_a, 1);
3708 $pool->clear;
3709 }
3710