1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! anni-fetch
//!
//! `anni-fetch` is interact with git server and fetch pack files from it.
//! It implemented git v2 protocol and PACK file uncompression, which is used in git fetch procedure.
//!
//! # Example
//!
//! ```rust
//! use anni_fetch::client::Message::PackData;
//! use anni_fetch::{Pack, Client};
//! use std::io::Cursor;
//! use anni_fetch::client::RequestBuilder;
//!
//! fn main() {
//! let client = Client::new("https://github.com/project-anni/repo.git");
//! let iter = client.request(
//! RequestBuilder::new(true)
//! .command("fetch")
//! .argument("thin-pack")
//! .argument("ofs-delta")
//! .argument("deepen 1")
//! .want(&client.ls_ref("HEAD").expect("failed to get sha1 of HEAD"))
//! .argument("done")
//! .build()
//! ).unwrap();
//! let mut pack = Vec::new();
//! for msg in iter {
//! match msg {
//! PackData(mut d) => pack.append(&mut d),
//! _ => {}
//! }
//! }
//! let mut cursor = Cursor::new(pack);
//! Pack::from_reader(&mut cursor).expect("invalid pack file");
//! }
//! ```
//!
//! You can use `match` to filter the type of message you want.
//! For example, you can just receive `Message::PackData` and
//! write the content to a `pak` file.
pub use Client;
pub use Pack;