Skip to content

Commit b34bdfa

Browse files
authored
Merge pull request #1940 from EliahKagan/run-ci/ghost-feature-next
Have `gix-filter` depend on `gix-packetline-blocking` unaliased
2 parents 62ec0e3 + 2d560c7 commit b34bdfa

File tree

5 files changed

+35
-34
lines changed

5 files changed

+35
-34
lines changed

gix-filter/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ gix-command = { version = "^0.5.0", path = "../gix-command" }
2222
gix-quote = { version = "^0.5.0", path = "../gix-quote" }
2323
gix-utils = { version = "^0.2.0", path = "../gix-utils" }
2424
gix-path = { version = "^0.10.15", path = "../gix-path" }
25-
gix-packetline = { package = "gix-packetline-blocking", version = "^0.18.3", path = "../gix-packetline-blocking" }
25+
gix-packetline-blocking = { version = "^0.18.3", path = "../gix-packetline-blocking" }
2626
gix-attributes = { version = "^0.25.0", path = "../gix-attributes" }
2727

2828
encoding_rs = "0.8.32"

gix-filter/src/driver/process/client.rs

+14-13
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub mod invoke {
4141
#[error("Failed to read or write to the process")]
4242
Io(#[from] std::io::Error),
4343
#[error(transparent)]
44-
PacketlineDecode(#[from] gix_packetline::decode::Error),
44+
PacketlineDecode(#[from] gix_packetline_blocking::decode::Error),
4545
}
4646

4747
impl From<super::Error> for Error {
@@ -65,17 +65,18 @@ impl Client {
6565
versions: &[usize],
6666
desired_capabilities: &[&str],
6767
) -> 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"));
6970
out.write_all(format!("{welcome_prefix}-client").as_bytes())?;
7071
for version in versions {
7172
out.write_all(format!("version={version}").as_bytes())?;
7273
}
73-
gix_packetline::encode::flush_to_write(out.inner_mut())?;
74+
gix_packetline_blocking::encode::flush_to_write(out.inner_mut())?;
7475
out.flush()?;
7576

76-
let mut input = gix_packetline::StreamingPeekableIter::new(
77+
let mut input = gix_packetline_blocking::StreamingPeekableIter::new(
7778
process.stdout.take().expect("configured stdout when spawning"),
78-
&[gix_packetline::PacketLineRef::Flush],
79+
&[gix_packetline_blocking::PacketLineRef::Flush],
7980
false, /* packet tracing */
8081
);
8182
let mut read = input.as_read();
@@ -125,10 +126,10 @@ impl Client {
125126
for capability in desired_capabilities {
126127
out.write_all(format!("capability={capability}").as_bytes())?;
127128
}
128-
gix_packetline::encode::flush_to_write(out.inner_mut())?;
129+
gix_packetline_blocking::encode::flush_to_write(out.inner_mut())?;
129130
out.flush()?;
130131

131-
read.reset_with(&[gix_packetline::PacketLineRef::Flush]);
132+
read.reset_with(&[gix_packetline_blocking::PacketLineRef::Flush]);
132133
let mut capabilities = HashSet::new();
133134
loop {
134135
buf.clear();
@@ -167,7 +168,7 @@ impl Client {
167168
) -> Result<process::Status, invoke::Error> {
168169
self.send_command_and_meta(command, meta)?;
169170
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())?;
171172
self.input.flush()?;
172173
Ok(self.read_status()?)
173174
}
@@ -189,15 +190,15 @@ impl Client {
189190
inspect_line(line.as_bstr());
190191
}
191192
}
192-
self.out.reset_with(&[gix_packetline::PacketLineRef::Flush]);
193+
self.out.reset_with(&[gix_packetline_blocking::PacketLineRef::Flush]);
193194
let status = self.read_status()?;
194195
Ok(status)
195196
}
196197

197198
/// Return a `Read` implementation that reads the server process output until the next flush package, and validates
198199
/// the status. If the status indicates failure, the last read will also fail.
199200
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]);
201202
ReadProcessOutputAndStatus {
202203
inner: self.out.as_read(),
203204
}
@@ -225,7 +226,7 @@ impl Client {
225226
buf.push_str(&value);
226227
self.input.write_all(&buf)?;
227228
}
228-
gix_packetline::encode::flush_to_write(self.input.inner_mut())?;
229+
gix_packetline_blocking::encode::flush_to_write(self.input.inner_mut())?;
229230
Ok(())
230231
}
231232
}
@@ -248,7 +249,7 @@ fn read_status(read: &mut PacketlineReader<'_>) -> std::io::Result<process::Stat
248249
if count > 0 && matches!(status, process::Status::Previous) {
249250
status = process::Status::Unset;
250251
}
251-
read.reset_with(&[gix_packetline::PacketLineRef::Flush]);
252+
read.reset_with(&[gix_packetline_blocking::PacketLineRef::Flush]);
252253
Ok(status)
253254
}
254255

@@ -260,7 +261,7 @@ impl std::io::Read for ReadProcessOutputAndStatus<'_> {
260261
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
261262
let num_read = self.inner.read(buf)?;
262263
if num_read == 0 {
263-
self.inner.reset_with(&[gix_packetline::PacketLineRef::Flush]);
264+
self.inner.reset_with(&[gix_packetline_blocking::PacketLineRef::Flush]);
264265
let status = read_status(&mut self.inner)?;
265266
if status.is_success() {
266267
Ok(0)

gix-filter/src/driver/process/mod.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub struct Client {
1212
/// The negotiated version of the protocol.
1313
version: usize,
1414
/// A way to send packet-line encoded information to the process.
15-
input: gix_packetline::Writer<std::process::ChildStdin>,
15+
input: gix_packetline_blocking::Writer<std::process::ChildStdin>,
1616
/// A way to read information sent to us by the process.
17-
out: gix_packetline::StreamingPeekableIter<std::process::ChildStdout>,
17+
out: gix_packetline_blocking::StreamingPeekableIter<std::process::ChildStdout>,
1818
}
1919

2020
/// A handle to facilitate typical server interactions that include the handshake and command-invocations.
@@ -24,9 +24,9 @@ pub struct Server {
2424
/// The negotiated version of the protocol, it's the highest supported one.
2525
version: usize,
2626
/// A way to receive information from the client.
27-
input: gix_packetline::StreamingPeekableIter<std::io::StdinLock<'static>>,
27+
input: gix_packetline_blocking::StreamingPeekableIter<std::io::StdinLock<'static>>,
2828
/// A way to send information to the client.
29-
out: gix_packetline::Writer<std::io::StdoutLock<'static>>,
29+
out: gix_packetline_blocking::Writer<std::io::StdoutLock<'static>>,
3030
}
3131

3232
/// The return status of an [invoked command][Client::invoke()].
@@ -109,5 +109,8 @@ pub mod client;
109109
///
110110
pub mod server;
111111

112-
type PacketlineReader<'a, T = std::process::ChildStdout> =
113-
gix_packetline::read::WithSidebands<'a, T, fn(bool, &[u8]) -> gix_packetline::read::ProgressAction>;
112+
type PacketlineReader<'a, T = std::process::ChildStdout> = gix_packetline_blocking::read::WithSidebands<
113+
'a,
114+
T,
115+
fn(bool, &[u8]) -> gix_packetline_blocking::read::ProgressAction,
116+
>;

gix-filter/src/driver/process/server.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub mod next_request {
2626
#[error("{msg} '{actual}'")]
2727
Protocol { msg: String, actual: BString },
2828
#[error(transparent)]
29-
PacketlineDecode(#[from] gix_packetline::decode::Error),
29+
PacketlineDecode(#[from] gix_packetline_blocking::decode::Error),
3030
}
3131
}
3232

@@ -63,9 +63,9 @@ impl Server {
6363
pick_version: &mut dyn FnMut(&[usize]) -> Option<usize>,
6464
available_capabilities: &[&str],
6565
) -> Result<Self, handshake::Error> {
66-
let mut input = gix_packetline::StreamingPeekableIter::new(
66+
let mut input = gix_packetline_blocking::StreamingPeekableIter::new(
6767
stdin.lock(),
68-
&[gix_packetline::PacketLineRef::Flush],
68+
&[gix_packetline_blocking::PacketLineRef::Flush],
6969
false, /* packet tracing */
7070
);
7171
let mut read = input.as_read();
@@ -104,11 +104,11 @@ impl Server {
104104
);
105105
}
106106
let version = pick_version(&versions).ok_or(handshake::Error::VersionMismatch { actual: versions })?;
107-
read.reset_with(&[gix_packetline::PacketLineRef::Flush]);
108-
let mut out = gix_packetline::Writer::new(stdout.lock());
107+
read.reset_with(&[gix_packetline_blocking::PacketLineRef::Flush]);
108+
let mut out = gix_packetline_blocking::Writer::new(stdout.lock());
109109
out.write_all(format!("{welcome_prefix}-server").as_bytes())?;
110110
out.write_all(format!("version={version}").as_bytes())?;
111-
gix_packetline::encode::flush_to_write(out.inner_mut())?;
111+
gix_packetline_blocking::encode::flush_to_write(out.inner_mut())?;
112112
out.flush()?;
113113

114114
let mut capabilities = HashSet::new();
@@ -132,7 +132,7 @@ impl Server {
132132
for cap in &capabilities {
133133
out.write_all(format!("capability={cap}").as_bytes())?;
134134
}
135-
gix_packetline::encode::flush_to_write(out.inner_mut())?;
135+
gix_packetline_blocking::encode::flush_to_write(out.inner_mut())?;
136136
out.flush()?;
137137

138138
drop(read);
@@ -196,7 +196,7 @@ impl Server {
196196
}
197197

198198
drop(read);
199-
self.input.reset_with(&[gix_packetline::PacketLineRef::Flush]);
199+
self.input.reset_with(&[gix_packetline_blocking::PacketLineRef::Flush]);
200200

201201
Ok(Some(Request {
202202
parent: self,
@@ -233,7 +233,7 @@ mod request {
233233
if let Some(message) = status.message() {
234234
out.write_all(format!("status={message}").as_bytes())?;
235235
}
236-
gix_packetline::encode::flush_to_write(out.inner_mut())?;
236+
gix_packetline_blocking::encode::flush_to_write(out.inner_mut())?;
237237
out.flush()
238238
}
239239
}
@@ -248,7 +248,7 @@ mod request {
248248
}
249249

250250
struct WriteAndFlushOnDrop<'a> {
251-
inner: &'a mut gix_packetline::Writer<std::io::StdoutLock<'static>>,
251+
inner: &'a mut gix_packetline_blocking::Writer<std::io::StdoutLock<'static>>,
252252
}
253253

254254
impl std::io::Write for WriteAndFlushOnDrop<'_> {
@@ -263,7 +263,7 @@ mod request {
263263

264264
impl Drop for WriteAndFlushOnDrop<'_> {
265265
fn drop(&mut self) {
266-
gix_packetline::encode::flush_to_write(self.inner.inner_mut()).ok();
266+
gix_packetline_blocking::encode::flush_to_write(self.inner.inner_mut()).ok();
267267
self.inner.flush().ok();
268268
}
269269
}

gix-packetline-blocking/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ blocking-io = []
2424
## DO NOT USE, instead use `gix-packetline` directly.
2525
async-io = []
2626

27-
## DO NOT USE, instead use `gix-packetline` directly (and still don't specify `futures-lite`).
28-
futures-lite = []
29-
3027
#! ### Other
3128
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
3229
serde = ["dep:serde", "bstr/serde"]

0 commit comments

Comments
 (0)