chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
30016dc
)
remote protocol fixes
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 22 Oct 2013 16:46:47 +0000
(17:46 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 22 Oct 2013 16:46:47 +0000
(17:46 +0100)
dgit
patch
|
blob
|
history
diff --git
a/dgit
b/dgit
index 6ec99acb31c13b998bc7c3dcdd4c13620dcd7b03..186b19e688df8e457bb6f9a99c9bd35b5dffda7e 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-180,7
+180,6
@@
sub changedir ($) {
sub badproto ($$) {
my ($fh, $m) = @_;
fail "connection lost: $!" if $fh->error;
sub badproto ($$) {
my ($fh, $m) = @_;
fail "connection lost: $!" if $fh->error;
- fail "connection terminated" if $fh->eof;
fail "protocol violation; $m not expected";
}
fail "protocol violation; $m not expected";
}
@@
-208,9
+207,8
@@
sub protocol_send_file ($$) {
die "$ourfn: $!" unless defined $got;
last if !$got;
print $fh "data-block ".length($d)."\n" or die $!;
die "$ourfn: $!" unless defined $got;
last if !$got;
print $fh "data-block ".length($d)."\n" or die $!;
- print $d or die $!;
+ print $
fh $
d or die $!;
}
}
- PF->eof or die "$ourfn $!";
PF->error and die "$ourfn $!";
print $fh "data-end\n" or die $!;
close PF;
PF->error and die "$ourfn $!";
print $fh "data-end\n" or die $!;
close PF;
@@
-249,7
+247,7
@@
sub responder_send_command ($) {
return unless $we_are_responder;
# called even without $we_are_responder
printdebug "<< $command\n";
return unless $we_are_responder;
# called even without $we_are_responder
printdebug "<< $command\n";
- print $command, "\n" or die $!;
+ print
PO
$command, "\n" or die $!;
}
sub responder_send_file ($$) {
}
sub responder_send_file ($$) {
@@
-257,7
+255,7
@@
sub responder_send_file ($$) {
return unless $we_are_responder;
printdebug "[[ $keyword $ourfn\n";
responder_send_command "file $keyword";
return unless $we_are_responder;
printdebug "[[ $keyword $ourfn\n";
responder_send_command "file $keyword";
- protocol_send_file \*
STDOUT
, $ourfn;
+ protocol_send_file \*
PO
, $ourfn;
}
sub responder_receive_files ($@) {
}
sub responder_receive_files ($@) {
@@
-266,9
+264,9
@@
sub responder_receive_files ($@) {
printdebug "]] $keyword @ourfns\n";
responder_send_command "want $keyword";
foreach my $fn (@ourfns) {
printdebug "]] $keyword @ourfns\n";
responder_send_command "want $keyword";
foreach my $fn (@ourfns) {
- protocol_receive_file \*
STDIN
, $fn;
+ protocol_receive_file \*
PI
, $fn;
}
}
- protocol_expect { m/^files-end$/ } \*
STDIN
;
+ protocol_expect { m/^files-end$/ } \*
PI
;
}
#---------- remote protocol support, initiator ----------
}
#---------- remote protocol support, initiator ----------
@@
-284,7
+282,7
@@
sub progress {
if ($we_are_responder) {
my $m = join '', @_;
responder_send_command "progress ".length($m) or die $!;
if ($we_are_responder) {
my $m = join '', @_;
responder_send_command "progress ".length($m) or die $!;
- print $m or die $!;
+ print
PO
$m or die $!;
} else {
print @_, "\n";
}
} else {
print @_, "\n";
}
@@
-1422,10
+1420,18
@@
sub cmd_remote_push_responder {
die unless @rargs;
my ($dir) = @rargs;
$debugprefix = ' ';
die unless @rargs;
my ($dir) = @rargs;
$debugprefix = ' ';
- changedir $dir;
$we_are_responder = 1;
$we_are_responder = 1;
+
+ open PI, "<&STDIN" or die $!;
+ open STDIN, "/dev/null" or die $!;
+ open PO, ">&STDOUT" or die $!;
+ autoflush PO 1;
+ open STDOUT, ">&STDERR" or die $!;
autoflush STDOUT 1;
autoflush STDOUT 1;
+
responder_send_command("dgit-remote-push-ready");
responder_send_command("dgit-remote-push-ready");
+
+ changedir $dir;
&cmd_push;
}
&cmd_push;
}