WIP: Add repository entries to collab and synchronize when rejoining the room

co-authored-by: Max <max@zed.dev>
This commit is contained in:
Mikayla Maki
2023-05-08 14:33:59 -07:00
co-authored by Max
parent 2fe5bf419b
commit 8301ee43d6
8 changed files with 267 additions and 70 deletions
+6 -6
View File
@@ -330,9 +330,10 @@ message UpdateWorktree {
repeated Entry updated_entries = 4;
repeated uint64 removed_entries = 5;
repeated RepositoryEntry updated_repositories = 6;
uint64 scan_id = 7;
bool is_last_update = 8;
string abs_path = 9;
repeated uint64 removed_repositories = 7;
uint64 scan_id = 8;
bool is_last_update = 9;
string abs_path = 10;
}
message CreateProjectEntry {
@@ -981,10 +982,9 @@ message Entry {
}
message RepositoryEntry {
uint64 git_dir_entry_id = 1;
uint64 dot_git_entry_id = 1;
uint64 scan_id = 2;
bytes git_dir_path = 3;
bytes work_directory = 4;
string work_directory = 4;
optional string branch = 5;
}
+8
View File
@@ -509,6 +509,13 @@ pub fn split_worktree_update(
.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();
Some(UpdateWorktree {
project_id: message.project_id,
@@ -520,6 +527,7 @@ pub fn split_worktree_update(
scan_id: message.scan_id,
is_last_update: done && message.is_last_update,
updated_repositories,
removed_repositories,
})
})
}