From 2a180cc038d39e58a2aa99075695e01d4013b69b Mon Sep 17 00:00:00 2001 From: Mx Kookie Date: Mon, 9 Nov 2020 18:59:25 +0100 Subject: [PATCH] supergit: adding functions to external interface to load files --- apps/servers/octopus/supergit/src/files.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/apps/servers/octopus/supergit/src/files.rs b/apps/servers/octopus/supergit/src/files.rs index 2a1b69a3456..d86a82306ee 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> { + 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