# HG changeset patch # User Raphaël Gomès # Date 1649148928 -7200 # Node ID ce919b1a1063a7826b635ad24aeb73a68d09cbc7 # Parent fbc02ccc207eaf1a1efeaedbbbcacddf6296a9fc rust-dirstatemap: correctly decrement the copies counter This was caught when writing unit tests for the `DirstateMap`. We were always setting `had_copy_source` to `false` since we erased the value just before. Differential Revision: https://phab.mercurial-scm.org/D12432 diff -r fbc02ccc207e -r ce919b1a1063 rust/hg-core/src/dirstate_tree/dirstate_map.rs --- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Tue Apr 05 10:55:28 2022 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Tue Apr 05 10:55:28 2022 +0200 @@ -864,14 +864,16 @@ if had_entry { node.data = NodeData::None } + let mut had_copy_source = false; if let Some(source) = &node.copy_source { DirstateMap::count_dropped_path(unreachable_bytes, source); + had_copy_source = true; node.copy_source = None } dropped = Dropped { was_tracked, had_entry, - had_copy_source: node.copy_source.take().is_some(), + had_copy_source, }; } // After recursion, for both leaf (rest_of_path is None) nodes and