rust-repo: don't use on-disk dirstate parents in v1
This mistake was not causing any problems yet since we were never updating
parents from Rust code. This is about to change, so let's fix it.
--- 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)