Module radicle_surf::vcs::git [−][src]
use nonempty::NonEmpty; use radicle_surf::file_system::{Directory, File, Label, Path, SystemType}; use radicle_surf::file_system::unsound; use radicle_surf::vcs::git::*; use std::collections::HashMap; let repo = Repository::new("../data/git-platinum")?; // Pin the browser to a parituclar commit. let pin_commit = Oid::from_str("3873745c8f6ffb45c990eb23b491d4b4b6182f95")?; let mut browser = Browser::new(&repo, Branch::local("master"))?; browser.commit(pin_commit)?; let directory = browser.get_directory()?; let mut directory_contents = directory.list_directory(); directory_contents.sort(); assert_eq!(directory_contents, vec![ SystemType::file(unsound::label::new(".i-am-well-hidden")), SystemType::file(unsound::label::new(".i-too-am-hidden")), SystemType::file(unsound::label::new("README.md")), SystemType::directory(unsound::label::new("bin")), SystemType::directory(unsound::label::new("src")), SystemType::directory(unsound::label::new("text")), SystemType::directory(unsound::label::new("this")), ]); // find src directory in the Git directory and the in-memory directory let src_directory = directory .find_directory(Path::new(unsound::label::new("src"))) .expect("failed to find src"); let mut src_directory_contents = src_directory.list_directory(); src_directory_contents.sort(); assert_eq!(src_directory_contents, vec![ SystemType::file(unsound::label::new("Eval.hs")), SystemType::file(unsound::label::new("Folder.svelte")), SystemType::file(unsound::label::new("memory.rs")), ]);
Re-exports
pub use git2; |
pub use branch::Branch; |
pub use branch::BranchName; |
pub use branch::BranchType; |
pub use tag::Tag; |
pub use tag::TagName; |
pub use commit::Author; |
pub use commit::Commit; |
pub use namespace::Namespace; |
pub use stats::Stats; |
pub use crate::diff::Diff; |
Modules
branch | Provides the data for talking about branches. |
commit | Provides the data for talking about commits. |
error | Collection of errors and helper instances that can occur when performing
operations from |
namespace | Provides the data for talking about namespaces. |
stats | Provides the data for talking about repository statistics. |
tag | Provides the data for talking about tags. |
Structs
Git2Error | A structure to represent errors coming out of libgit2. |
Oid | Unique identity of any object (commit, tree, blob, tag). |
Repository | Wrapper around the |
RepositoryRef | A reference-only |
Signature | The signature of a commit |
Time | Time in a signature |
Enums
Ref | A structured way of referring to a git reference. |
Rev | A revision within the repository. |
Type Definitions
Browser | A |
History | A |