comparison rust/hg-core/src/dirstate_tree/on_disk.rs @ 49156:09984dc70352 stable

rust-dirstate-v2: fix the unused bytes counter when rewriting the dirstate As per the previous patch, the counter was incorrectly carried over from the old docket when it should be reset for a complete rewrite. Differential Revision: https://phab.mercurial-scm.org/D12594
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 28 Apr 2022 17:15:35 +0200
parents dd2503a63d33
children a932cad26d37 6cd249556e20
comparison
equal deleted inserted replaced
49155:c69adc82e7f7 49156:09984dc70352
620 out: Vec::with_capacity(size_guess), 620 out: Vec::with_capacity(size_guess),
621 }; 621 };
622 622
623 let root_nodes = writer.write_nodes(dirstate_map.root.as_ref())?; 623 let root_nodes = writer.write_nodes(dirstate_map.root.as_ref())?;
624 624
625 let unreachable_bytes = if append {
626 dirstate_map.unreachable_bytes
627 } else {
628 0
629 };
625 let meta = TreeMetadata { 630 let meta = TreeMetadata {
626 root_nodes, 631 root_nodes,
627 nodes_with_entry_count: dirstate_map.nodes_with_entry_count.into(), 632 nodes_with_entry_count: dirstate_map.nodes_with_entry_count.into(),
628 nodes_with_copy_source_count: dirstate_map 633 nodes_with_copy_source_count: dirstate_map
629 .nodes_with_copy_source_count 634 .nodes_with_copy_source_count
630 .into(), 635 .into(),
631 unreachable_bytes: dirstate_map.unreachable_bytes.into(), 636 unreachable_bytes: unreachable_bytes.into(),
632 unused: [0; 4], 637 unused: [0; 4],
633 ignore_patterns_hash: dirstate_map.ignore_patterns_hash, 638 ignore_patterns_hash: dirstate_map.ignore_patterns_hash,
634 }; 639 };
635 Ok((writer.out, meta, append, dirstate_map.old_data_size)) 640 Ok((writer.out, meta, append, dirstate_map.old_data_size))
636 } 641 }