@@ -41,7 +41,7 @@ pub mod invoke {
41
41
#[ error( "Failed to read or write to the process" ) ]
42
42
Io ( #[ from] std:: io:: Error ) ,
43
43
#[ error( transparent) ]
44
- PacketlineDecode ( #[ from] gix_packetline :: decode:: Error ) ,
44
+ PacketlineDecode ( #[ from] gix_packetline_blocking :: decode:: Error ) ,
45
45
}
46
46
47
47
impl From < super :: Error > for Error {
@@ -65,17 +65,18 @@ impl Client {
65
65
versions : & [ usize ] ,
66
66
desired_capabilities : & [ & str ] ,
67
67
) -> Result < Self , handshake:: Error > {
68
- let mut out = gix_packetline:: Writer :: new ( process. stdin . take ( ) . expect ( "configured stdin when spawning" ) ) ;
68
+ let mut out =
69
+ gix_packetline_blocking:: Writer :: new ( process. stdin . take ( ) . expect ( "configured stdin when spawning" ) ) ;
69
70
out. write_all ( format ! ( "{welcome_prefix}-client" ) . as_bytes ( ) ) ?;
70
71
for version in versions {
71
72
out. write_all ( format ! ( "version={version}" ) . as_bytes ( ) ) ?;
72
73
}
73
- gix_packetline :: encode:: flush_to_write ( out. inner_mut ( ) ) ?;
74
+ gix_packetline_blocking :: encode:: flush_to_write ( out. inner_mut ( ) ) ?;
74
75
out. flush ( ) ?;
75
76
76
- let mut input = gix_packetline :: StreamingPeekableIter :: new (
77
+ let mut input = gix_packetline_blocking :: StreamingPeekableIter :: new (
77
78
process. stdout . take ( ) . expect ( "configured stdout when spawning" ) ,
78
- & [ gix_packetline :: PacketLineRef :: Flush ] ,
79
+ & [ gix_packetline_blocking :: PacketLineRef :: Flush ] ,
79
80
false , /* packet tracing */
80
81
) ;
81
82
let mut read = input. as_read ( ) ;
@@ -125,10 +126,10 @@ impl Client {
125
126
for capability in desired_capabilities {
126
127
out. write_all ( format ! ( "capability={capability}" ) . as_bytes ( ) ) ?;
127
128
}
128
- gix_packetline :: encode:: flush_to_write ( out. inner_mut ( ) ) ?;
129
+ gix_packetline_blocking :: encode:: flush_to_write ( out. inner_mut ( ) ) ?;
129
130
out. flush ( ) ?;
130
131
131
- read. reset_with ( & [ gix_packetline :: PacketLineRef :: Flush ] ) ;
132
+ read. reset_with ( & [ gix_packetline_blocking :: PacketLineRef :: Flush ] ) ;
132
133
let mut capabilities = HashSet :: new ( ) ;
133
134
loop {
134
135
buf. clear ( ) ;
@@ -167,7 +168,7 @@ impl Client {
167
168
) -> Result < process:: Status , invoke:: Error > {
168
169
self . send_command_and_meta ( command, meta) ?;
169
170
std:: io:: copy ( content, & mut self . input ) ?;
170
- gix_packetline :: encode:: flush_to_write ( self . input . inner_mut ( ) ) ?;
171
+ gix_packetline_blocking :: encode:: flush_to_write ( self . input . inner_mut ( ) ) ?;
171
172
self . input . flush ( ) ?;
172
173
Ok ( self . read_status ( ) ?)
173
174
}
@@ -189,15 +190,15 @@ impl Client {
189
190
inspect_line ( line. as_bstr ( ) ) ;
190
191
}
191
192
}
192
- self . out . reset_with ( & [ gix_packetline :: PacketLineRef :: Flush ] ) ;
193
+ self . out . reset_with ( & [ gix_packetline_blocking :: PacketLineRef :: Flush ] ) ;
193
194
let status = self . read_status ( ) ?;
194
195
Ok ( status)
195
196
}
196
197
197
198
/// Return a `Read` implementation that reads the server process output until the next flush package, and validates
198
199
/// the status. If the status indicates failure, the last read will also fail.
199
200
pub fn as_read ( & mut self ) -> impl std:: io:: Read + ' _ {
200
- self . out . reset_with ( & [ gix_packetline :: PacketLineRef :: Flush ] ) ;
201
+ self . out . reset_with ( & [ gix_packetline_blocking :: PacketLineRef :: Flush ] ) ;
201
202
ReadProcessOutputAndStatus {
202
203
inner : self . out . as_read ( ) ,
203
204
}
@@ -225,7 +226,7 @@ impl Client {
225
226
buf. push_str ( & value) ;
226
227
self . input . write_all ( & buf) ?;
227
228
}
228
- gix_packetline :: encode:: flush_to_write ( self . input . inner_mut ( ) ) ?;
229
+ gix_packetline_blocking :: encode:: flush_to_write ( self . input . inner_mut ( ) ) ?;
229
230
Ok ( ( ) )
230
231
}
231
232
}
@@ -248,7 +249,7 @@ fn read_status(read: &mut PacketlineReader<'_>) -> std::io::Result<process::Stat
248
249
if count > 0 && matches ! ( status, process:: Status :: Previous ) {
249
250
status = process:: Status :: Unset ;
250
251
}
251
- read. reset_with ( & [ gix_packetline :: PacketLineRef :: Flush ] ) ;
252
+ read. reset_with ( & [ gix_packetline_blocking :: PacketLineRef :: Flush ] ) ;
252
253
Ok ( status)
253
254
}
254
255
@@ -260,7 +261,7 @@ impl std::io::Read for ReadProcessOutputAndStatus<'_> {
260
261
fn read ( & mut self , buf : & mut [ u8 ] ) -> std:: io:: Result < usize > {
261
262
let num_read = self . inner . read ( buf) ?;
262
263
if num_read == 0 {
263
- self . inner . reset_with ( & [ gix_packetline :: PacketLineRef :: Flush ] ) ;
264
+ self . inner . reset_with ( & [ gix_packetline_blocking :: PacketLineRef :: Flush ] ) ;
264
265
let status = read_status ( & mut self . inner ) ?;
265
266
if status. is_success ( ) {
266
267
Ok ( 0 )
0 commit comments