From 6bed200ec1a528574edabf5783e9ebfb00add56d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 17 Jul 2020 13:12:06 +0800 Subject: [PATCH] empty trees are allowed, and they are special, too Essentially they are the root tree, and can be used to diff against nothing, showing everything --- git-object/src/owned/tree.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/git-object/src/owned/tree.rs b/git-object/src/owned/tree.rs index 50ac4e188fb..cc5a24a0b78 100644 --- a/git-object/src/owned/tree.rs +++ b/git-object/src/owned/tree.rs @@ -6,9 +6,6 @@ use std::io; quick_error! { #[derive(Debug)] pub enum Error { - NoEntries { - description("Trees must have at least one entry") - } NewlineInFilename(name: BString){ display("Newlines are invalid in file paths: {:?}", name) } @@ -50,9 +47,6 @@ impl TreeMode { impl Tree { pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> { - if self.entries.is_empty() { - return Err(Error::NoEntries.into()); - } for Entry { mode, filename, oid } in &self.entries { out.write_all(mode.as_bytes())?; out.write_all(SPACE)?;