rust/hg-core/src/repo.rs
changeset 52043 e1fe336c007a
parent 52042 28a0eb21ff04
child 52045 a8cf6a852f11
--- a/rust/hg-core/src/repo.rs	Tue Oct 01 13:45:18 2024 +0200
+++ b/rust/hg-core/src/repo.rs	Wed Oct 02 13:36:51 2024 +0200
@@ -450,11 +450,14 @@
         debug_wait_for_file_or_print(self.config(), "dirstate.pre-read-file");
         let identity = self.dirstate_identity()?;
         let dirstate_file_contents = self.dirstate_file_contents()?;
+        let parents = self.dirstate_parents()?;
         if dirstate_file_contents.is_empty() {
-            self.dirstate_parents.set(DirstateParents::NULL);
+            self.dirstate_parents.set(parents);
             Ok(OwningDirstateMap::new_empty(Vec::new(), identity))
         } else {
-            let (map, parents) =
+            // Ignore the dirstate on-disk parents, they may have been set in
+            // the repo before
+            let (map, _) =
                 OwningDirstateMap::new_v1(dirstate_file_contents, identity)?;
             self.dirstate_parents.set(parents);
             Ok(map)