+ cleanup($self) if alternates_changed($self);
+ check_git_exe();
+ if ($GIT_VER >= BATCH_CMD_VER) {
+ _bidi_pipe($self, qw(batch-command in out pid err_c));
+ $self->{-bc} = 1;
+ $self->{inflight} = [];
+ } else {
+ _bidi_pipe($self, qw(batch-check in_c out_c pid_c err_c));
+ $self->{inflight_c} = [];
+ }
+}
+
+sub write_all {
+ my ($self, $out, $buf, $read_step, $inflight) = @_;
+ $read_step->($self, $inflight) while @$inflight >= MAX_INFLIGHT;
+ do {
+ my $w = syswrite($out, $buf);
+ if (defined $w) {
+ return if $w == length($buf);
+ substr($buf, 0, $w, ''); # sv_chop
+ } elsif ($! != EAGAIN) {
+ $self->fail("write: $!");
+ }
+ $read_step->($self, $inflight);
+ } while (1);