aboutsummaryrefslogtreecommitdiff
path: root/supergit/src/raw
diff options
context:
space:
mode:
authorKaiden Fey <kookie@spacekookie.de>2020-10-25 05:36:08 +0100
committerKatharina Fey <kookie@spacekookie.de>2020-10-25 05:36:08 +0100
commit63cd5d0a8d3f77c0267f12a6aef52533cc2f7d09 (patch)
treed46fb6058a6ade2726154fff76d5bda1d6dfc7e0 /supergit/src/raw
parent392444d21101ce7b637f2e5a385490605f93ccf1 (diff)
Adding a whole lot of shit (octopus and supergit)
Diffstat (limited to 'supergit/src/raw')
-rw-r--r--supergit/src/raw/mod.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/supergit/src/raw/mod.rs b/supergit/src/raw/mod.rs
new file mode 100644
index 0000000..b2f67a4
--- /dev/null
+++ b/supergit/src/raw/mod.rs
@@ -0,0 +1,39 @@
+//! Raw representation wrappers for libgit2
+
+use git2::{self, Repository};
+
+pub(crate) type RawResult<T> = Result<T, RawError>;
+
+/// An error abstraction for raw git operations
+#[derive(Debug)]
+pub(crate) enum RawError {
+ AllBad,
+}
+
+impl From<git2::Error> for RawError {
+ fn from(_: git2::Error) -> Self {
+ Self::AllBad
+ }
+}
+
+/// Wrap a libgit2 repository to provide an API fascade
+pub(crate) struct RawRepository {
+ inner: Repository,
+}
+
+impl RawRepository {
+ pub(crate) fn open(path: &str) -> RawResult<Self> {
+ Ok(Self {
+ inner: Repository::open(path)?,
+ })
+ }
+
+ /// Sync the backing storage with the backing git repo
+ ///
+ /// This function can be invoked manually, but should be invoked
+ /// basically every time your program expects changes to have
+ /// happened. Polling this function is not recommended.
+ pub(crate) fn update(&self) -> RawResult<()> {
+ Ok(())
+ }
+}