Skip to content

Commit 6bed200

Browse files
committed
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
1 parent 56b66ac commit 6bed200

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

git-object/src/owned/tree.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ use std::io;
66
quick_error! {
77
#[derive(Debug)]
88
pub enum Error {
9-
NoEntries {
10-
description("Trees must have at least one entry")
11-
}
129
NewlineInFilename(name: BString){
1310
display("Newlines are invalid in file paths: {:?}", name)
1411
}
@@ -50,9 +47,6 @@ impl TreeMode {
5047

5148
impl Tree {
5249
pub fn write_to(&self, mut out: impl io::Write) -> io::Result<()> {
53-
if self.entries.is_empty() {
54-
return Err(Error::NoEntries.into());
55-
}
5650
for Entry { mode, filename, oid } in &self.entries {
5751
out.write_all(mode.as_bytes())?;
5852
out.write_all(SPACE)?;

0 commit comments

Comments
 (0)