Crates.io | gitbrowse |
lib.rs | gitbrowse |
version | 0.0.6 |
source | src |
created_at | 2021-04-04 10:53:41.825274 |
updated_at | 2022-02-27 10:27:15.950617 |
description | A simple way to browse a git repository |
homepage | |
repository | https://github.com/trangar/gitbrowse |
max_upload_size | |
id | 378716 |
size | 22,559 |
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 current_branch = match repo.current_branch()? {
Some(b) => b,
None => return Ok(())
};
println!("Current branch: {:?}", current_branch.name());
for file in current_branch.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());
}
}
}
Licensed under either of
at your option.
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.