Maintain remote worktrees correctly when building updates

This accidentally regressed in 53327e2.
This commit is contained in:
Antonio Scandurra
2022-03-03 16:13:17 +01:00
parent c613b22619
commit 410ee124af
2 changed files with 26 additions and 6 deletions
+23 -1
View File
@@ -534,7 +534,12 @@ impl Store {
for entry in updated_entries {
worktree.entries.insert(entry.id, entry.clone());
}
Ok(project.connection_ids())
let connection_ids = project.connection_ids();
#[cfg(test)]
self.check_invariants();
Ok(connection_ids)
}
pub fn project_connection_ids(
@@ -619,6 +624,23 @@ impl Store {
.guests
.contains_key(connection_id));
}
if let Some(share) = project.share.as_ref() {
for (worktree_id, worktree) in share.worktrees.iter() {
let mut paths = HashMap::default();
for entry in worktree.entries.values() {
let prev_entry = paths.insert(&entry.path, entry);
assert_eq!(
prev_entry,
None,
"worktree {:?}, duplicate path for entries {:?} and {:?}",
worktree_id,
prev_entry.unwrap(),
entry
);
}
}
}
}
for channel_id in &connection.channels {
let channel = self.channels.get(channel_id).unwrap();