gitbrowse 0.0.1

A simple way to browse a git repository
Documentation

Crates.io docs.rs Workflow Status

gitbrowse

A crate to browse a git repository in a way that most people are used to. Heavily inspired by how people browse a git repository on github and gitlab.


let repo = Repo::open(".")?;

let branches = repo.list_branches()?;
println!("Found the following branches:");
for branch in &branches {
    println!(" - {}", branch);
}


let branch = repo.browse_branch(branches.first().unwrap())?;
for file in branch.list_files() {
    println!("Found file: {:?}", file.path());
    println!("File's content is length {}", file.read_content_string()?.len());

    println!("File is modified in the following commits:");
    for commit in file.history()? {
        if let Ok(commit) = commit {
            println!("  {}: {}", commit.id(), commit.message());
        }
    }
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.