@@ -3,7 +3,6 @@ use std::{
33 collections:: { BTreeMap , BTreeSet , HashMap } ,
44 fmt:: Debug ,
55 num:: ParseIntError ,
6- path:: PathBuf ,
76 str:: FromStr ,
87 sync:: Mutex ,
98} ;
@@ -35,6 +34,7 @@ use crate::{
3534 IndexFile , IndexPack , PackHeader , PackHeaderLength , PackHeaderRef , packfile:: PackId ,
3635 } ,
3736 repository:: { Open , Repository } ,
37+ util:: SerializablePath ,
3838} ;
3939
4040#[ derive( Clone , Copy , Debug , Default ) ]
@@ -643,22 +643,22 @@ fn check_trees(
643643 NodeType :: File => node. content . as_ref ( ) . map_or_else (
644644 || {
645645 collector. add_error ( CheckError :: FileHasNoContent {
646- file : path. join ( node. name ( ) ) ,
646+ file : SerializablePath ( path. join ( node. name ( ) ) ) ,
647647 } ) ;
648648 } ,
649649 |content| {
650650 for ( i, id) in content. iter ( ) . enumerate ( ) {
651651 if id. is_null ( ) {
652652 collector. add_error ( CheckError :: FileBlobHasNullId {
653- file : path. join ( node. name ( ) ) ,
653+ file : SerializablePath ( path. join ( node. name ( ) ) ) ,
654654 blob_num : i,
655655 } ) ;
656656 }
657657
658658 match index. get_data ( id) {
659659 None => {
660660 collector. add_error ( CheckError :: FileBlobNotInIndex {
661- file : path. join ( node. name ( ) ) ,
661+ file : SerializablePath ( path. join ( node. name ( ) ) ) ,
662662 blob_id : * id,
663663 } ) ;
664664 }
@@ -673,17 +673,17 @@ fn check_trees(
673673 NodeType :: Dir => {
674674 match node. subtree {
675675 None => collector. add_error ( CheckError :: NoSubTree {
676- dir : path. join ( node. name ( ) ) ,
676+ dir : SerializablePath ( path. join ( node. name ( ) ) ) ,
677677 } ) ,
678678 Some ( tree) if tree. is_null ( ) => {
679679 collector. add_error ( CheckError :: NullSubTree {
680- dir : path. join ( node. name ( ) ) ,
680+ dir : SerializablePath ( path. join ( node. name ( ) ) ) ,
681681 } ) ;
682682 }
683683 Some ( id) => match index. get_tree ( & id) {
684684 None => {
685685 collector. add_error ( CheckError :: SubTreeMissingInIndex {
686- dir : path. join ( node. name ( ) ) ,
686+ dir : SerializablePath ( path. join ( node. name ( ) ) ) ,
687687 blob_id : id,
688688 } ) ;
689689 }
@@ -887,17 +887,26 @@ pub enum CheckError {
887887 /// pack {id} is referenced by the index but not present! To repair: 'rustic repair index'.
888888 NoPack { id : PackId } ,
889889 /// file {file:?} doesn't have a content
890- FileHasNoContent { file : PathBuf } ,
890+ FileHasNoContent { file : SerializablePath } ,
891891 /// file {file:?} blob {blob_num} has null ID
892- FileBlobHasNullId { file : PathBuf , blob_num : usize } ,
892+ FileBlobHasNullId {
893+ file : SerializablePath ,
894+ blob_num : usize ,
895+ } ,
893896 /// file {file:?} blob {blob_id} is missing in index
894- FileBlobNotInIndex { file : PathBuf , blob_id : DataId } ,
897+ FileBlobNotInIndex {
898+ file : SerializablePath ,
899+ blob_id : DataId ,
900+ } ,
895901 /// dir {dir:?} doesn't have a subtree
896- NoSubTree { dir : PathBuf } ,
902+ NoSubTree { dir : SerializablePath } ,
897903 /// "dir {dir:?} subtree has null ID
898- NullSubTree { dir : PathBuf } ,
904+ NullSubTree { dir : SerializablePath } ,
899905 /// "dir {dir:?} subtree blob {blob_id} is missing in index",
900- SubTreeMissingInIndex { dir : PathBuf , blob_id : TreeId } ,
906+ SubTreeMissingInIndex {
907+ dir : SerializablePath ,
908+ blob_id : TreeId ,
909+ } ,
901910 /// pack {id}: data size does not match expected size. Read: {size} bytes, expected: {expected} bytes
902911 PackSizeMismatch {
903912 id : PackId ,
0 commit comments