Show More
@@ -23,8 +23,13 type ParseResult<'a> = ( | |||||
23 | pub fn parse_dirstate_parents( |
|
23 | pub fn parse_dirstate_parents( | |
24 | contents: &[u8], |
|
24 | contents: &[u8], | |
25 | ) -> Result<&DirstateParents, HgError> { |
|
25 | ) -> Result<&DirstateParents, HgError> { | |
26 | let (parents, _rest) = DirstateParents::from_bytes(contents) |
|
26 | let contents_len = contents.len(); | |
27 | .map_err(|_| HgError::corrupted("Too little data for dirstate."))?; |
|
27 | let (parents, _rest) = | |
|
28 | DirstateParents::from_bytes(contents).map_err(|_| { | |||
|
29 | HgError::corrupted(format!( | |||
|
30 | "Too little data for dirstate: {contents_len} bytes.", | |||
|
31 | )) | |||
|
32 | })?; | |||
28 | Ok(parents) |
|
33 | Ok(parents) | |
29 | } |
|
34 | } | |
30 |
|
35 |
General Comments 0
You need to be logged in to leave comments.
Login now