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 48 49 50 51 52 53 54 55
#![warn(missing_docs)] //! 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. //! //! ```rust //! # use gitbrowse::*; //! # fn main() -> Result<(), Box<dyn std::error::Error>> { //! //! 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()); //! //! current_branch.files(|file| { //! println!("Found file: {:?}", file.path()); //! if let Ok(content) = file.read_content_string() { //! println!("File's content is length {}", content.len()); //! } //! //! println!("File is modified in the following commits:"); //! for commit in file.history()? { //! if let Ok(commit) = commit { //! println!(" {}: {}", commit.id(), commit.message()); //! } //! } //! Ok(()) //! })?; //! //! # Ok(()) //! # } //! ``` mod branch; mod commit; mod file; mod repo; mod utils; pub use self::branch::Branch; pub use self::commit::Commit; pub use self::file::File; pub use self::repo::Repo; pub use self::utils::*; pub use git2::Error;