File tree 4 files changed +29
-2
lines changed
4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,11 @@ impl Manifest {
112
112
}
113
113
114
114
iter_tree ( self , self . root ( ) , & mut root) ;
115
- tracking:: Manifest :: new ( root)
115
+ let mut manifest = tracking:: Manifest :: new ( root) ;
116
+ // ensure that the manifest will round-trip in the case of it
117
+ // being converted back into this type
118
+ manifest. set_header ( self . header ( ) . to_owned ( ) ) ;
119
+ manifest
116
120
}
117
121
118
122
pub ( super ) fn legacy_encode ( & self , mut writer : & mut impl std:: io:: Write ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -539,6 +539,16 @@ impl std::fmt::Debug for Header {
539
539
}
540
540
}
541
541
542
+ impl std:: borrow:: ToOwned for Header {
543
+ type Owned = HeaderBuf ;
544
+
545
+ fn to_owned ( & self ) -> Self :: Owned {
546
+ let mut buf = HeaderBuf ( Default :: default ( ) ) ;
547
+ buf. 0 [ ..] . clone_from_slice ( & self . 0 ) ;
548
+ buf
549
+ }
550
+ }
551
+
542
552
impl std:: ops:: Deref for Header {
543
553
type Target = [ u8 ] ;
544
554
@@ -638,6 +648,12 @@ impl std::ops::Deref for HeaderBuf {
638
648
}
639
649
}
640
650
651
+ impl std:: borrow:: Borrow < Header > for HeaderBuf {
652
+ fn borrow ( & self ) -> & Header {
653
+ self
654
+ }
655
+ }
656
+
641
657
impl AsRef < Header > for HeaderBuf {
642
658
#[ inline]
643
659
fn as_ref ( & self ) -> & Header {
Original file line number Diff line number Diff line change @@ -90,8 +90,12 @@ impl<T> Manifest<T> {
90
90
}
91
91
}
92
92
93
+ pub fn header ( & self ) -> & graph:: object:: Header {
94
+ & self . header
95
+ }
96
+
93
97
pub fn set_header ( & mut self , mut header : graph:: object:: HeaderBuf ) {
94
- // an different object kind would cause bugs and should never be allowed
98
+ // a different object kind would cause bugs and should never be allowed
95
99
header. set_object_kind ( graph:: ObjectKind :: Manifest ) ;
96
100
self . header = header;
97
101
}
Original file line number Diff line number Diff line change @@ -886,6 +886,9 @@ fn split_manifest_by_component(
886
886
let mut manifests = HashMap :: with_capacity ( components. len ( ) ) ;
887
887
for component in components. iter ( ) {
888
888
let mut component_manifest = spfs:: tracking:: Manifest :: default ( ) ;
889
+ // ensure we are storing things with the same settings as the
890
+ // original manifest that was generated by the build
891
+ component_manifest. set_header ( manifest. header ( ) . to_owned ( ) ) ;
889
892
890
893
// identify all the file paths that we will replicate
891
894
// first so that we can also identify necessary
You can’t perform that action at this time.
0 commit comments