@@ -640,6 +640,7 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
640
640
fn write_parents_of (
641
641
& mut self ,
642
642
path : & Utf8Path ,
643
+ root : & gio:: File ,
643
644
cache : & mut HashSet < Utf8PathBuf > ,
644
645
) -> Result < ( ) > {
645
646
let Some ( parent) = path. parent ( ) else {
@@ -654,15 +655,11 @@ impl<'a, W: std::io::Write> OstreeTarWriter<'a, W> {
654
655
return Ok ( ( ) ) ;
655
656
}
656
657
657
- self . write_parents_of ( parent, cache) ?;
658
+ self . write_parents_of ( parent, root , cache) ?;
658
659
659
660
let inserted = cache. insert ( parent. to_owned ( ) ) ;
660
661
debug_assert ! ( inserted) ;
661
662
662
- let root = self
663
- . repo
664
- . read_commit ( & self . commit_checksum , gio:: Cancellable :: NONE ) ?
665
- . 0 ;
666
663
let parent_file = root. resolve_relative_path ( unmap_path ( parent) . as_ref ( ) ) ;
667
664
let queryattrs = "unix::*" ;
668
665
let queryflags = gio:: FileQueryInfoFlags :: NOFOLLOW_SYMLINKS ;
@@ -733,13 +730,17 @@ fn write_chunk<W: std::io::Write>(
733
730
create_parent_dirs : bool ,
734
731
) -> Result < ( ) > {
735
732
let mut cache = std:: collections:: HashSet :: new ( ) ;
733
+ let root = writer
734
+ . repo
735
+ . read_commit ( & writer. commit_checksum , gio:: Cancellable :: NONE ) ?
736
+ . 0 ;
736
737
for ( checksum, ( _size, paths) ) in chunk. into_iter ( ) {
737
738
let ( objpath, h) = writer. append_content ( checksum. borrow ( ) ) ?;
738
739
for path in paths. iter ( ) {
739
740
let path = path_for_tar_v1 ( path) ;
740
741
let h = h. clone ( ) ;
741
742
if create_parent_dirs {
742
- writer. write_parents_of ( & path, & mut cache) ?;
743
+ writer. write_parents_of ( & path, & root , & mut cache) ?;
743
744
}
744
745
writer. append_content_hardlink ( & objpath, h, path) ?;
745
746
}
0 commit comments