Skip to content

Commit

Permalink
empty trees are allowed, and they are special, too
Browse files Browse the repository at this point in the history
Essentially they are the root tree, and can be used to diff against
nothing, showing everything
  • Loading branch information
Byron committed Jul 17, 2020
1 parent 56b66ac commit 6bed200
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions git-object/src/owned/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)?;
Expand Down

0 comments on commit 6bed200

Please sign in to comment.