diff --git a/rust/hg-core/src/revlog/changelog.rs b/rust/hg-core/src/revlog/changelog.rs --- a/rust/hg-core/src/revlog/changelog.rs +++ b/rust/hg-core/src/revlog/changelog.rs @@ -336,6 +336,11 @@ message", changelog.data_for_rev(NULL_REVISION)?, ChangelogRevisionData::null() ); + // same with the intermediate entry object + assert_eq!( + changelog.entry_for_rev(NULL_REVISION)?.data()?, + ChangelogRevisionData::null() + ); Ok(()) } } diff --git a/rust/hg-core/src/revlog/mod.rs b/rust/hg-core/src/revlog/mod.rs --- a/rust/hg-core/src/revlog/mod.rs +++ b/rust/hg-core/src/revlog/mod.rs @@ -562,6 +562,9 @@ impl<'revlog> RevlogEntry<'revlog> { pub fn data(&self) -> Result, HgError> { let data = self.rawdata()?; + if self.rev == NULL_REVISION { + return Ok(data); + } if self.is_censored() { return Err(HgError::CensoredNodeError); } @@ -688,6 +691,9 @@ mod tests { revlog.rev_from_node(NULL_NODE.into()).unwrap(), NULL_REVISION ); + let null_entry = revlog.get_entry(NULL_REVISION).ok().unwrap(); + assert_eq!(null_entry.revision(), NULL_REVISION); + assert!(null_entry.data().unwrap().is_empty()); } #[test]