Fix logic error when streaming ignored entries
We were calling `next` twice, which led us to skip every other entry. This commit also enhances the `test_share_project` integration test to exercise this new streaming logic.
This commit is contained in:
parent
94e70bc1a6
commit
85f228dade
2 changed files with 32 additions and 14 deletions
|
@ -963,7 +963,11 @@ impl LocalWorktree {
|
|||
.filter(|e| e.is_ignored);
|
||||
let mut ignored_entries_to_send = Vec::new();
|
||||
loop {
|
||||
const CHUNK_SIZE: usize = 256;
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
const CHUNK_SIZE: usize = 2;
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
const CHUNK_SIZE: usize = 128;
|
||||
|
||||
let entry = ignored_entries.next();
|
||||
if ignored_entries_to_send.len() >= CHUNK_SIZE || entry.is_none() {
|
||||
rpc.request(proto::UpdateWorktree {
|
||||
|
@ -977,7 +981,7 @@ impl LocalWorktree {
|
|||
.await?;
|
||||
}
|
||||
|
||||
if let Some(entry) = ignored_entries.next() {
|
||||
if let Some(entry) = entry {
|
||||
ignored_entries_to_send.push(entry.into());
|
||||
} else {
|
||||
break;
|
||||
|
@ -1179,7 +1183,6 @@ impl Snapshot {
|
|||
|
||||
for entry in update.updated_entries {
|
||||
let entry = Entry::try_from((&self.root_char_bag, entry))?;
|
||||
println!("{:?} = {}", &entry.path, entry.is_ignored);
|
||||
if let Some(PathEntry { path, .. }) = self.entries_by_id.get(&entry.id, &()) {
|
||||
entries_by_path_edits.push(Edit::Remove(PathKey(path.clone())));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue