Removed scan ID from repository interfaces

co-authored-by: Max <max@zed.dev>
This commit is contained in:
Mikayla Maki 2023-05-05 16:33:21 -07:00
parent 270147d20c
commit d8dac07408
No known key found for this signature in database
5 changed files with 172 additions and 175 deletions

View file

@ -982,9 +982,8 @@ message Entry {
}
message RepositoryEntry {
uint64 scan_id = 1;
uint64 work_directory_id = 2;
optional string branch = 3;
uint64 work_directory_id = 1;
optional string branch = 2;
}
message BufferState {

View file

@ -5,13 +5,13 @@ use futures::{SinkExt as _, StreamExt as _};
use prost::Message as _;
use serde::Serialize;
use std::any::{Any, TypeId};
use std::fmt;
use std::{
cmp,
fmt::Debug,
io, iter,
time::{Duration, SystemTime, UNIX_EPOCH},
};
use std::{fmt, mem};
include!(concat!(env!("OUT_DIR"), "/zed.messages.rs"));
@ -502,21 +502,22 @@ pub fn split_worktree_update(
.drain(..removed_entries_chunk_size)
.collect();
let updated_repositories_chunk_size =
cmp::min(message.updated_repositories.len(), max_chunk_size);
let updated_repositories = message
.updated_repositories
.drain(..updated_repositories_chunk_size)
.collect();
let removed_repositories_chunk_size =
cmp::min(message.removed_repositories.len(), max_chunk_size);
let removed_repositories = message
.removed_repositories
.drain(..removed_repositories_chunk_size)
.collect();
done = message.updated_entries.is_empty() && message.removed_entries.is_empty();
// Wait to send repositories until after we've guarnteed that their associated entries
// will be read
let updated_repositories = if done {
mem::take(&mut message.updated_repositories)
} else {
Default::default()
};
let removed_repositories = if done {
mem::take(&mut message.removed_repositories)
} else {
Default::default()
};
Some(UpdateWorktree {
project_id: message.project_id,
worktree_id: message.worktree_id,