blob: 7bf6c0a396a48c2a48852fe25b47d14307dee6d5 (
plain)
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
|
//! 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!()
}
}
|