aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-11-09 18:59:25 +0100
committerMx Kookie <kookie@spacekookie.de>2020-11-09 18:59:25 +0100
commitcae1d76a0777ddfc5864f0c64eba4a3dfad6a1b7 (patch)
tree7b1b2cc240454b2b1eeebeb4d7217a10ff72b511 /apps
parentefa9d11a5f4bcdc6f719966b727c006dbfd9f271 (diff)
supergit: adding functions to external interface to load files
Diffstat (limited to 'apps')
-rw-r--r--apps/servers/octopus/supergit/src/files.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/servers/octopus/supergit/src/files.rs b/apps/servers/octopus/supergit/src/files.rs
index 2a1b69a34562..d86a82306eef 100644
--- a/apps/servers/octopus/supergit/src/files.rs
+++ b/apps/servers/octopus/supergit/src/files.rs
@@ -73,6 +73,28 @@ impl TreeEntry {
_ => unimplemented!(),
}
}
+
+ /// Load this tree entry from disk, if it is a file
+ ///
+ /// When calling this function on a directory, nothing will
+ /// happen, because directories can't be loaded. If you want to
+ /// get a list of children for a directory, use
+ /// [`FileTree::enumerate()`]() instead!
+ pub fn load(&self) -> Option<Vec<u8>> {
+ if !self.is_file() {
+ return None;
+ }
+
+ let obj =
+ }
+
+ /// Check if this tree entry is a file
+ pub fn is_file(&self) -> bool {
+ match self {
+ Self::File(_) => true,
+ Self::Dir(_) => false,
+ }
+ }
}
/// A file to have ever existed in a git repo