Object::is_root

pull/19/head
Niko PLP 2 years ago
parent ac3ad8ce9a
commit 57d1f5f967
  1. 2
      p2p-repo/src/branch.rs
  2. 5
      p2p-repo/src/object.rs

@ -130,7 +130,7 @@ impl Branch {
let id = cobj.id();
// root has no deps
let is_root = cobj.deps().len() == 0;
let is_root = cobj.is_root();
//debug_println!(" deps: {:?}", cobj.deps());
// check if this commit object is present in their_heads

@ -379,6 +379,11 @@ impl Object {
}
}
pub fn is_root(&self) -> bool {
self.deps().len() == 0
//TODO: add && sdeps().len() == 0 && self.acks().len() == 0 && self.nacks().len() == 0
}
pub fn root(&self) -> &Block {
self.blocks.last().unwrap()
}

Loading…
Cancel
Save