diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix-protocol/src/handshake/refs | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-protocol/src/handshake/refs')
-rw-r--r-- | vendor/gix-protocol/src/handshake/refs/tests.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/gix-protocol/src/handshake/refs/tests.rs b/vendor/gix-protocol/src/handshake/refs/tests.rs index a7c9171a5..7d995da5c 100644 --- a/vendor/gix-protocol/src/handshake/refs/tests.rs +++ b/vendor/gix-protocol/src/handshake/refs/tests.rs @@ -170,6 +170,20 @@ impl<'a> gix_transport::client::ReadlineBufRead for Fixture<'a> { self.0 = lines.as_bytes(); Some(Ok(Ok(gix_packetline::PacketLineRef::Data(res)))) } + + fn readline_str(&mut self, line: &mut String) -> std::io::Result<usize> { + use bstr::{BStr, ByteSlice}; + let bytes: &BStr = self.0.into(); + let mut lines = bytes.lines(); + let res = match lines.next() { + None => return Ok(0), + Some(line) => line, + }; + self.0 = lines.as_bytes(); + let len = res.len(); + line.push_str(res.to_str().expect("valid UTF8 in fixture")); + Ok(len) + } } #[cfg(feature = "async-client")] @@ -220,4 +234,17 @@ impl<'a> gix_transport::client::ReadlineBufRead for Fixture<'a> { self.0 = lines.as_bytes(); Some(Ok(Ok(gix_packetline::PacketLineRef::Data(res)))) } + async fn readline_str(&mut self, line: &mut String) -> std::io::Result<usize> { + use bstr::{BStr, ByteSlice}; + let bytes: &BStr = self.0.into(); + let mut lines = bytes.lines(); + let res = match lines.next() { + None => return Ok(0), + Some(line) => line, + }; + self.0 = lines.as_bytes(); + let len = res.len(); + line.push_str(res.to_str().expect("valid UTF8 in fixture")); + Ok(len) + } } |