diff --git a/rust/hg-core/src/dirstate/parsers.rs b/rust/hg-core/src/dirstate/parsers.rs --- a/rust/hg-core/src/dirstate/parsers.rs +++ b/rust/hg-core/src/dirstate/parsers.rs @@ -23,8 +23,13 @@ type ParseResult<'a> = ( pub fn parse_dirstate_parents( contents: &[u8], ) -> Result<&DirstateParents, HgError> { - let (parents, _rest) = DirstateParents::from_bytes(contents) - .map_err(|_| HgError::corrupted("Too little data for dirstate."))?; + let contents_len = contents.len(); + let (parents, _rest) = + DirstateParents::from_bytes(contents).map_err(|_| { + HgError::corrupted(format!( + "Too little data for dirstate: {contents_len} bytes.", + )) + })?; Ok(parents) }