|
|
|
@ -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
|
|
|
|
|