Mercurial > hg
changeset 45710:510995e249c0
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 09 Oct 2020 10:20:53 +0200 |
parents | 91fafafd5a68 |
children | 3d68b47e461b |
files | rust/hg-core/src/dirstate/dirstate_tree/node.rs |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/dirstate_tree/node.rs Thu Oct 08 18:50:46 2020 +0200 +++ b/rust/hg-core/src/dirstate/dirstate_tree/node.rs Fri Oct 09 10:20:53 2020 +0200 @@ -57,9 +57,11 @@ 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,