@@ -640,6 +640,7 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
640640 fn write_parents_of (
641641 & mut self ,
642642 path : & Utf8Path ,
643+ root : & gio:: File ,
643644 cache : & mut HashSet < Utf8PathBuf > ,
644645 ) -> Result < ( ) > {
645646 let Some ( parent) = path. parent ( ) else {
@@ -654,15 +655,11 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
654655 return Ok ( ( ) ) ;
655656 }
656657
657- self . write_parents_of ( parent, cache) ?;
658+ self . write_parents_of ( parent, root , cache) ?;
658659
659660 let inserted = cache. insert ( parent. to_owned ( ) ) ;
660661 debug_assert ! ( inserted) ;
661662
662- let root = self
663- . repo
664- . read_commit ( & self . commit_checksum , gio:: Cancellable :: NONE ) ?
665- . 0 ;
666663 let parent_file = root. resolve_relative_path ( unmap_path ( parent) . as_ref ( ) ) ;
667664 let queryattrs = "unix::*" ;
668665 let queryflags = gio:: FileQueryInfoFlags :: NOFOLLOW_SYMLINKS ;
@@ -733,13 +730,17 @@ fn write_chunk<W: std::io::Write>(
733730 create_parent_dirs : bool ,
734731) -> Result < ( ) > {
735732 let mut cache = std:: collections:: HashSet :: new ( ) ;
733+ let root = writer
734+ . repo
735+ . read_commit ( & writer. commit_checksum , gio:: Cancellable :: NONE ) ?
736+ . 0 ;
736737 for ( checksum, ( _size, paths) ) in chunk. into_iter ( ) {
737738 let ( objpath, h) = writer. append_content ( checksum. borrow ( ) ) ?;
738739 for path in paths. iter ( ) {
739740 let path = path_for_tar_v1 ( path) ;
740741 let h = h. clone ( ) ;
741742 if create_parent_dirs {
742- writer. write_parents_of ( & path, & mut cache) ?;
743+ writer. write_parents_of ( & path, & root , & mut cache) ?;
743744 }
744745 writer. append_content_hardlink ( & objpath, h, path) ?;
745746 }
0 commit comments