chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rpush: Support empty files in protocol_read_bytes
[dgit.git]
/
dgit
diff --git
a/dgit
b/dgit
index 687ebe14337ce29c8cab701e0b69393875f103f7..d5aa38718c551c7c46b32ecf6c046bb502a50b96 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-39,7
+39,8
@@
use Debian::Dgit;
our $our_version = 'UNRELEASED'; ###substituted###
our $our_version = 'UNRELEASED'; ###substituted###
-our $rpushprotovsn = 2;
+our @rpushprotovsn_support = qw(2);
+our $protovsn;
our $isuite = 'unstable';
our $idistro;
our $isuite = 'unstable';
our $idistro;
@@
-175,7
+176,9
@@
sub deliberately_not_fast_forward () {
#---------- remote protocol support, common ----------
# remote push initiator/responder protocol:
#---------- remote protocol support, common ----------
# remote push initiator/responder protocol:
-# < dgit-remote-push-ready [optional extra info ignored by old initiators]
+# $ dgit remote-push-build-host <n-rargs> <rargs>... <push-args>...
+# where <rargs> is <push-host-dir> <supported-proto-vsn>,... ...
+# < dgit-remote-push-ready <actual-proto-vsn>
#
# > file parsed-changelog
# [indicates that output of dpkg-parsechangelog follows]
#
# > file parsed-changelog
# [indicates that output of dpkg-parsechangelog follows]
@@
-270,7
+273,7
@@
sub protocol_send_file ($$) {
sub protocol_read_bytes ($$) {
my ($fh, $nbytes) = @_;
sub protocol_read_bytes ($$) {
my ($fh, $nbytes) = @_;
- $nbytes =~ m/^[1-9]\d{0,5}$/ or badproto \*RO, "bad byte count";
+ $nbytes =~ m/^[1-9]\d{0,5}$
|^0$
/ or badproto \*RO, "bad byte count";
my $d;
my $got = read $fh, $d, $nbytes;
$got==$nbytes or badproto_badread $fh, "data block";
my $d;
my $got = read $fh, $d, $nbytes;
$got==$nbytes or badproto_badread $fh, "data block";
@@
-2104,11
+2107,16
@@
sub cmd_remote_push_build_host {
autoflush STDOUT 1;
$vsnwant //= 1;
autoflush STDOUT 1;
$vsnwant //= 1;
- fail "build host has dgit rpush protocol version".
- " $rpushprotovsn but invocation host has $vsnwant"
-
unless grep { $rpushprotovsn eq $_ } split /,/, $vsnwan
t;
+ ($protovsn) = grep {
+ $vsnwant =~ m{^(?:.*,)?$_(?:,.*)?$}
+
} @rpushprotovsn_suppor
t;
- responder_send_command("dgit-remote-push-ready $rpushprotovsn");
+ fail "build host has dgit rpush protocol versions ".
+ (join ",", @rpushprotovsn_support).
+ " but invocation host has $vsnwant"
+ unless defined $protovsn;
+
+ responder_send_command("dgit-remote-push-ready $protovsn");
changedir $dir;
&cmd_push;
changedir $dir;
&cmd_push;
@@
-2154,7
+2162,8
@@
sub cmd_rpush {
$dir = nextarg;
}
$dir =~ s{^-}{./-};
$dir = nextarg;
}
$dir =~ s{^-}{./-};
- my @rargs = ($dir,$rpushprotovsn);
+ my @rargs = ($dir);
+ push @rargs, join ",", @rpushprotovsn_support;
my @rdgit;
push @rdgit, @dgit;
push @rdgit, @ropts;
my @rdgit;
push @rdgit, @dgit;
push @rdgit, @ropts;
@@
-2172,7
+2181,8
@@
sub cmd_rpush {
}
$i_child_pid = open2(\*RO, \*RI, @cmd);
changedir $i_tmp;
}
$i_child_pid = open2(\*RO, \*RI, @cmd);
changedir $i_tmp;
- initiator_expect { m/^dgit-remote-push-ready/ };
+ ($protovsn) = initiator_expect { m/^dgit-remote-push-ready (\S+)/ };
+ die "$protovsn ?" unless grep { $_ eq $protovsn } @rpushprotovsn_support;
for (;;) {
my ($icmd,$iargs) = initiator_expect {
m/^(\S+)(?: (.*))?$/;
for (;;) {
my ($icmd,$iargs) = initiator_expect {
m/^(\S+)(?: (.*))?$/;
@@
-3078,6
+3088,7
@@
if ($ENV{$fakeeditorenv}) {
}
parseopts();
}
parseopts();
+
print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1;
print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n"
if $dryrun_level == 1;
print STDERR "DRY RUN ONLY\n" if $dryrun_level > 1;
print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n"
if $dryrun_level == 1;