use treelog::Tree;
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Git Repository Structure Example\n");
let tree = Tree::from_git_repo(".")?;
println!("Repository structure:");
println!("{}", tree.render_to_string());
println!("\n---\n");
let repo = git2::Repository::open(".")?;
let branches_tree = Tree::from_git_branches(&repo)?;
println!("Branches:");
println!("{}", branches_tree.render_to_string());
println!("\n---\n");
if let Ok(head) = repo.head()
&& let Ok(commit) = head.peel_to_commit()
&& let Ok(commit_tree) = Tree::from_git_commit_tree(&repo, &commit)
{
println!("HEAD commit tree:");
println!("{}", commit_tree.render_to_string());
}
Ok(())
}