1#![deny(clippy::pedantic)]
2#[cfg(feature = "tokio-util")]
24pub mod codec;
25mod error;
26pub mod high_level;
27pub mod low_level;
28mod packet_line;
29mod util;
30
31pub use error::Error;
32pub use packet_line::PktLine;
33
34#[cfg(test)]
35mod test {
36 use bytes::Bytes;
37 use std::process::{Command, Stdio};
38 use tempfile::TempDir;
39
40 pub fn verify_pack_file(packed: Bytes) -> String {
41 let scratch_dir = TempDir::new().unwrap();
42 let packfile_path = scratch_dir.path().join("example.pack");
43
44 std::fs::write(&packfile_path, packed).unwrap();
45
46 let res = Command::new("git")
47 .arg("index-pack")
48 .arg(&packfile_path)
49 .stdout(Stdio::piped())
50 .spawn()
51 .unwrap()
52 .wait()
53 .unwrap();
54 assert!(res.success());
55
56 let command = Command::new("git")
57 .arg("verify-pack")
58 .arg("-v")
59 .stdout(Stdio::piped())
60 .arg(&packfile_path)
61 .spawn()
62 .unwrap();
63
64 let out = command.wait_with_output().unwrap();
65 assert!(out.status.success(), "git exited non-0");
66
67 String::from_utf8(out.stdout).unwrap()
68 }
69}