thin-fetch 0.1.0

Low-level Git crate to fetch objects with high granularity
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use clap::{Arg, Command};
use thin_fetch::Repo;

fn main() {
    let args = Command::new("get_head")
        .arg(Arg::new("url").required(true).help("Repository URL"))
        .get_matches_from(std::env::args());

    let url = args.get_one::<String>("url").unwrap();

    let repo = Repo::new_discover(url).unwrap();

    match repo.get_ref("HEAD") {
        Ok(Some(head)) => println!("{}", head.target()),
        Ok(None) => eprintln!("head not found"),
        Err(err) => eprintln!("error: {err}"),
    }
}