Skip to content

Commit

Permalink
[clone] the problem actually was rooted in trying to read binary data
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 24, 2020
1 parent 7f2bdfa commit b7af002
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion git-packetline/src/reader/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ where
self.cap, 0,
"we don't support partial buffers right now - read-line must be used consistently"
);
let line = std::str::from_utf8(self.fill_buf()?).map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
let line = std::str::from_utf8(self.fill_buf()?)
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.unwrap();
buf.push_str(line);
let bytes = line.len();
self.cap = 0;
Expand Down
Binary file not shown.
5 changes: 3 additions & 2 deletions git-packetline/tests/packet_line/reader/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::io::{BufRead, Read};

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

let mut out = String::new();
Expand Down Expand Up @@ -37,7 +37,8 @@ fn read_line_trait_method_reads_one_packet_line_at_a_time() -> crate::Result {
assert_eq!(out, line);
Ok(())
};
assert_next("foo\n")?;
assert_next("&")?;
assert_next("")?;
Ok(())
}

Expand Down
1 change: 1 addition & 0 deletions tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* [x] `Write` with packet line encoding
* **git-transport**
* [x] parse capabilities
* [x] assure packet reader's `read_line(…)` is doing things exactly as we think it will (it does!)
* [ ] support for authentication providers
* [ ] http
* [ ] ssh?
Expand Down

0 comments on commit b7af002

Please sign in to comment.