# HG changeset patch # User Raphaël Gomès # Date 2024-10-02 11:36:51 # Node ID e1fe336c007ab3cfc9e6b4971ee78d0e310da7d0 # Parent 28a0eb21ff04e05067192469fe38912747341574 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. diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs --- a/rust/hg-core/src/repo.rs +++ b/rust/hg-core/src/repo.rs @@ -450,11 +450,14 @@ impl Repo { 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)