mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Send the root branch along with it's entry
This commit is contained in:
parent
89352a2bdc
commit
60320c6b09
@ -487,17 +487,37 @@ pub fn split_worktree_update(
|
||||
let mut done_files = false;
|
||||
let mut done_statuses = false;
|
||||
let mut repository_index = 0;
|
||||
let mut root_repo_found = false;
|
||||
iter::from_fn(move || {
|
||||
if done_files && done_statuses {
|
||||
return None;
|
||||
}
|
||||
|
||||
let updated_entries_chunk_size = cmp::min(message.updated_entries.len(), max_chunk_size);
|
||||
let updated_entries = message
|
||||
let updated_entries: Vec<_> = message
|
||||
.updated_entries
|
||||
.drain(..updated_entries_chunk_size)
|
||||
.collect();
|
||||
|
||||
let mut updated_repositories: Vec<_> = Default::default();
|
||||
|
||||
if !root_repo_found {
|
||||
for entry in updated_entries.iter() {
|
||||
if let Some(repo) = message.updated_repositories.get(0) {
|
||||
if repo.work_directory_id == entry.id {
|
||||
root_repo_found = true;
|
||||
updated_repositories.push(RepositoryEntry {
|
||||
work_directory_id: repo.work_directory_id,
|
||||
branch: repo.branch.clone(),
|
||||
removed_worktree_repo_paths: Default::default(),
|
||||
updated_worktree_statuses: Default::default(),
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let removed_entries_chunk_size = cmp::min(message.removed_entries.len(), max_chunk_size);
|
||||
let removed_entries = message
|
||||
.removed_entries
|
||||
@ -508,9 +528,8 @@ pub fn split_worktree_update(
|
||||
|
||||
// Wait to send repositories until after we've guaranteed that their associated entries
|
||||
// will be read
|
||||
let updated_repositories = if done_files {
|
||||
if done_files {
|
||||
let mut total_statuses = 0;
|
||||
let mut updated_repositories = Vec::new();
|
||||
while total_statuses < max_chunk_size
|
||||
&& repository_index < message.updated_repositories.len()
|
||||
{
|
||||
@ -555,8 +574,6 @@ pub fn split_worktree_update(
|
||||
repository_index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
updated_repositories
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user