Skip to content

Commit b7af002

Browse files
committed
[clone] the problem actually was rooted in trying to read binary data
1 parent 7f2bdfa commit b7af002

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

git-packetline/src/reader/read.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ where
6565
self.cap, 0,
6666
"we don't support partial buffers right now - read-line must be used consistently"
6767
);
68-
let line = std::str::from_utf8(self.fill_buf()?).map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
68+
let line = std::str::from_utf8(self.fill_buf()?)
69+
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
70+
.unwrap();
6971
buf.push_str(line);
7072
let bytes = line.len();
7173
self.cap = 0;
583 Bytes
Binary file not shown.

git-packetline/tests/packet_line/reader/read.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::io::{BufRead, Read};
55

66
#[test]
77
fn read_line_trait_method_reads_one_packet_line_at_a_time() -> crate::Result {
8-
let buf = fixture_bytes("v1/01-clone.combined-output");
8+
let buf = fixture_bytes("v1/01-clone.combined-output-no-binary");
99
let mut rd = git_packetline::Reader::new(&buf[..], None);
1010

1111
let mut out = String::new();
@@ -37,7 +37,8 @@ fn read_line_trait_method_reads_one_packet_line_at_a_time() -> crate::Result {
3737
assert_eq!(out, line);
3838
Ok(())
3939
};
40-
assert_next("foo\n")?;
40+
assert_next("&")?;
41+
assert_next("")?;
4142
Ok(())
4243
}
4344

tasks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* [x] `Write` with packet line encoding
1919
* **git-transport**
2020
* [x] parse capabilities
21+
* [x] assure packet reader's `read_line(…)` is doing things exactly as we think it will (it does!)
2122
* [ ] support for authentication providers
2223
* [ ] http
2324
* [ ] ssh?

0 commit comments

Comments
 (0)