# HG changeset patch # User Pierre-Yves David # Date 2020-10-09 08:20:53 # Node ID 510995e249c0f89146cb380bd920b9a7bf4affd0 # Parent 91fafafd5a68f8cccdbce604ec0f09e1b7af9b54 dirstate-tree: move a conditional in an explicit boolean This will help readability a bit and make the next change simpler to read. Differential Revision: https://phab.mercurial-scm.org/D9202 diff --git a/rust/hg-core/src/dirstate/dirstate_tree/node.rs b/rust/hg-core/src/dirstate/dirstate_tree/node.rs --- a/rust/hg-core/src/dirstate/dirstate_tree/node.rs +++ b/rust/hg-core/src/dirstate/dirstate_tree/node.rs @@ -57,9 +57,11 @@ impl Node { let head = split.next().unwrap_or(b""); let tail = split.next().unwrap_or(b""); + // Are we're modifying the current file ? Is the the end of the path ? + let is_current_file = tail.is_empty() && head.is_empty(); + if let NodeKind::File(file) = &mut self.kind { - if tail.is_empty() && head.is_empty() { - // We're modifying the current file + if is_current_file { let new = Self { kind: NodeKind::File(File { entry: new_entry,