Fixed randomized test failures

co-authored-by: Max <max@zed.dev>
This commit is contained in:
Mikayla Maki 2023-05-05 17:30:54 -07:00
parent d8dac07408
commit ab952f1b31
No known key found for this signature in database

View file

@ -1673,12 +1673,12 @@ impl LocalSnapshot {
let mut updated_repositories: Vec<proto::RepositoryEntry> = Vec::new(); let mut updated_repositories: Vec<proto::RepositoryEntry> = Vec::new();
let mut removed_repositories = Vec::new(); let mut removed_repositories = Vec::new();
let mut self_repos = self.snapshot.repository_entries.values().peekable(); let mut self_repos = self.snapshot.repository_entries.iter().peekable();
let mut other_repos = other.snapshot.repository_entries.values().peekable(); let mut other_repos = other.snapshot.repository_entries.iter().peekable();
loop { loop {
match (self_repos.peek(), other_repos.peek()) { match (self_repos.peek(), other_repos.peek()) {
(Some(self_repo), Some(other_repo)) => { (Some((self_work_dir, self_repo)), Some((other_work_dir, other_repo))) => {
match Ord::cmp(&self_repo.work_directory, &other_repo.work_directory) { match Ord::cmp(self_work_dir, other_work_dir) {
Ordering::Less => { Ordering::Less => {
updated_repositories.push((*self_repo).into()); updated_repositories.push((*self_repo).into());
self_repos.next(); self_repos.next();
@ -1697,11 +1697,11 @@ impl LocalSnapshot {
} }
} }
} }
(Some(self_repo), None) => { (Some((_, self_repo)), None) => {
updated_repositories.push((*self_repo).into()); updated_repositories.push((*self_repo).into());
self_repos.next(); self_repos.next();
} }
(None, Some(other_repo)) => { (None, Some((_, other_repo))) => {
removed_repositories.push(other_repo.work_directory.to_proto()); removed_repositories.push(other_repo.work_directory.to_proto());
other_repos.next(); other_repos.next();
} }