node: Skip zero oids

Signed-off-by: Alexis Sellier <alexis@radicle.xyz>
This commit is contained in:
Alexis Sellier 2022-09-17 11:00:50 +02:00
parent 5b86131257
commit 071465388c
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -104,6 +104,9 @@ impl Refs {
let name = git::RefString::try_from(name)?;
let oid = Oid::from_str(oid)?;
if oid.is_zero() {
continue;
}
refs.insert(name, oid);
}
Ok(Self(refs))
@ -111,7 +114,9 @@ impl Refs {
pub fn canonical(&self) -> Vec<u8> {
let mut buf = String::new();
let refs = self.iter().filter(|(name, _)| *name != &*SIGNATURE_REF);
let refs = self
.iter()
.filter(|(name, oid)| *name != &*SIGNATURE_REF && !oid.is_zero());
for (name, oid) in refs {
buf.push_str(&oid.to_string());