diff options
author | Katharina Fey <kookie@spacekookie.de> | 2020-10-31 18:57:39 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-21 05:10:08 +0100 |
commit | 9dacf748651ea7139c0e9f3dee9ae66d949bf73f (patch) | |
tree | 7101bc20d5a531218ccd1b4cb9e04c67995f6d0e /apps/servers/octopus/supergit/src/raw/mod.rs | |
parent | 4e09fe2509904ee64d2470ca8d41006d51e4ffd6 (diff) |
Add 'apps/servers/octopus/' from commit '623954d19fdf0dca47db319e5c88ee561aa8d25c'
git-subtree-dir: apps/servers/octopus
git-subtree-mainline: 4e09fe2509904ee64d2470ca8d41006d51e4ffd6
git-subtree-split: 623954d19fdf0dca47db319e5c88ee561aa8d25c
Diffstat (limited to '')
-rw-r--r-- | apps/servers/octopus/supergit/src/raw/mod.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/apps/servers/octopus/supergit/src/raw/mod.rs b/apps/servers/octopus/supergit/src/raw/mod.rs new file mode 100644 index 000000000000..7bf6c0a396a4 --- /dev/null +++ b/apps/servers/octopus/supergit/src/raw/mod.rs @@ -0,0 +1,45 @@ +//! Raw representation wrappers for libgit2 + +mod branch_walk; +mod tree_walk; + +use crate::{Branch, BranchCommit}; +use git2::{self, Repository}; + +pub type RawResult<T> = Result<T, RawError>; + +/// An error abstraction for raw git operations +#[derive(Debug)] +pub enum RawError { + AllBad, +} + +impl From<git2::Error> for RawError { + fn from(_: git2::Error) -> Self { + Self::AllBad + } +} + +/// Represent a raw branch +pub struct RawBranch { + name: String, + head: String, +} + +/// Wrap a libgit2 repository to provide an API fascade +pub struct RawRepository { + inner: Repository, +} + +impl RawRepository { + pub fn open(path: &str) -> RawResult<Self> { + Ok(Self { + inner: Repository::open(path)?, + }) + } + + /// Parse branch data from repository + pub fn parse_branches(&self) -> RawResult<Vec<RawBranch>> { + todo!() + } +} |