diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47525:fe4641cf9b72

dirstate: use a `added` parameter to _addpath My next target are the explicit `state` byte, so let start with abstracting their initial storage. Differential Revision: https://phab.mercurial-scm.org/D10967
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 04 Jul 2021 01:42:10 +0200
parents 69a463a4f193
children c6b91a9c242a
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Sat Jul 03 20:59:26 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Sun Jul 04 01:42:10 2021 +0200
@@ -722,13 +722,15 @@
         &mut self,
         filename: &HgPath,
         entry: DirstateEntry,
+        added: bool,
         from_p2: bool,
         possibly_dirty: bool,
     ) -> Result<(), DirstateError> {
         let mut entry = entry;
-        if entry.state == EntryState::Added {
+        if added {
             assert!(!possibly_dirty);
             assert!(!from_p2);
+            entry.state = EntryState::Added;
             entry.size = SIZE_NON_NORMAL;
             entry.mtime = MTIME_UNSET;
         } else if from_p2 {