Merge remote-tracking branch 'origin/main' into global-gitignore
This commit is contained in:
commit
17822762b7
1193 changed files with 112606 additions and 40043 deletions
|
@ -62,7 +62,7 @@ use std::{
|
|||
},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use sum_tree::{Bias, Edit, KeyedItem, SeekTarget, SumTree, Summary, TreeMap, TreeSet, Unit};
|
||||
use sum_tree::{Bias, Edit, KeyedItem, SeekTarget, SumTree, Summary, TreeMap, TreeSet};
|
||||
use text::{LineEnding, Rope};
|
||||
use util::{
|
||||
ResultExt,
|
||||
|
@ -391,12 +391,12 @@ struct LocalRepositoryEntry {
|
|||
}
|
||||
|
||||
impl sum_tree::Item for LocalRepositoryEntry {
|
||||
type Summary = PathSummary<Unit>;
|
||||
type Summary = PathSummary<&'static ()>;
|
||||
|
||||
fn summary(&self, _: &<Self::Summary as Summary>::Context) -> Self::Summary {
|
||||
PathSummary {
|
||||
max_path: self.work_directory.path_key().0,
|
||||
item_summary: Unit,
|
||||
item_summary: &(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -409,12 +409,6 @@ impl KeyedItem for LocalRepositoryEntry {
|
|||
}
|
||||
}
|
||||
|
||||
//impl LocalRepositoryEntry {
|
||||
// pub fn repo(&self) -> &Arc<dyn GitRepository> {
|
||||
// &self.repo_ptr
|
||||
// }
|
||||
//}
|
||||
|
||||
impl Deref for LocalRepositoryEntry {
|
||||
type Target = WorkDirectory;
|
||||
|
||||
|
@ -2439,16 +2433,16 @@ impl Snapshot {
|
|||
self.entries_by_path = {
|
||||
let mut cursor = self.entries_by_path.cursor::<TraversalProgress>(&());
|
||||
let mut new_entries_by_path =
|
||||
cursor.slice(&TraversalTarget::path(&removed_entry.path), Bias::Left, &());
|
||||
cursor.slice(&TraversalTarget::path(&removed_entry.path), Bias::Left);
|
||||
while let Some(entry) = cursor.item() {
|
||||
if entry.path.starts_with(&removed_entry.path) {
|
||||
self.entries_by_id.remove(&entry.id, &());
|
||||
cursor.next(&());
|
||||
cursor.next();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
new_entries_by_path.append(cursor.suffix(&()), &());
|
||||
new_entries_by_path.append(cursor.suffix(), &());
|
||||
new_entries_by_path
|
||||
};
|
||||
|
||||
|
@ -2551,7 +2545,7 @@ impl Snapshot {
|
|||
include_dirs: bool,
|
||||
include_ignored: bool,
|
||||
start_offset: usize,
|
||||
) -> Traversal {
|
||||
) -> Traversal<'_> {
|
||||
let mut cursor = self.entries_by_path.cursor(&());
|
||||
cursor.seek(
|
||||
&TraversalTarget::Count {
|
||||
|
@ -2561,7 +2555,6 @@ impl Snapshot {
|
|||
include_ignored,
|
||||
},
|
||||
Bias::Right,
|
||||
&(),
|
||||
);
|
||||
Traversal {
|
||||
snapshot: self,
|
||||
|
@ -2578,19 +2571,19 @@ impl Snapshot {
|
|||
include_dirs: bool,
|
||||
include_ignored: bool,
|
||||
path: &Path,
|
||||
) -> Traversal {
|
||||
) -> Traversal<'_> {
|
||||
Traversal::new(self, include_files, include_dirs, include_ignored, path)
|
||||
}
|
||||
|
||||
pub fn files(&self, include_ignored: bool, start: usize) -> Traversal {
|
||||
pub fn files(&self, include_ignored: bool, start: usize) -> Traversal<'_> {
|
||||
self.traverse_from_offset(true, false, include_ignored, start)
|
||||
}
|
||||
|
||||
pub fn directories(&self, include_ignored: bool, start: usize) -> Traversal {
|
||||
pub fn directories(&self, include_ignored: bool, start: usize) -> Traversal<'_> {
|
||||
self.traverse_from_offset(false, true, include_ignored, start)
|
||||
}
|
||||
|
||||
pub fn entries(&self, include_ignored: bool, start: usize) -> Traversal {
|
||||
pub fn entries(&self, include_ignored: bool, start: usize) -> Traversal<'_> {
|
||||
self.traverse_from_offset(true, true, include_ignored, start)
|
||||
}
|
||||
|
||||
|
@ -2617,7 +2610,7 @@ impl Snapshot {
|
|||
options: ChildEntriesOptions,
|
||||
) -> ChildEntriesIter<'a> {
|
||||
let mut cursor = self.entries_by_path.cursor(&());
|
||||
cursor.seek(&TraversalTarget::path(parent_path), Bias::Right, &());
|
||||
cursor.seek(&TraversalTarget::path(parent_path), Bias::Right);
|
||||
let traversal = Traversal {
|
||||
snapshot: self,
|
||||
cursor,
|
||||
|
@ -3060,9 +3053,9 @@ impl BackgroundScannerState {
|
|||
.snapshot
|
||||
.entries_by_path
|
||||
.cursor::<TraversalProgress>(&());
|
||||
new_entries = cursor.slice(&TraversalTarget::path(path), Bias::Left, &());
|
||||
removed_entries = cursor.slice(&TraversalTarget::successor(path), Bias::Left, &());
|
||||
new_entries.append(cursor.suffix(&()), &());
|
||||
new_entries = cursor.slice(&TraversalTarget::path(path), Bias::Left);
|
||||
removed_entries = cursor.slice(&TraversalTarget::successor(path), Bias::Left);
|
||||
new_entries.append(cursor.suffix(), &());
|
||||
}
|
||||
self.snapshot.entries_by_path = new_entries;
|
||||
|
||||
|
@ -3942,7 +3935,7 @@ impl BackgroundScanner {
|
|||
let Ok(request) = path_prefix_request else { break };
|
||||
log::trace!("adding path prefix {:?}", request.path);
|
||||
|
||||
let did_scan = self.forcibly_load_paths(&[request.path.clone()]).await;
|
||||
let did_scan = self.forcibly_load_paths(std::slice::from_ref(&request.path)).await;
|
||||
if did_scan {
|
||||
let abs_path =
|
||||
{
|
||||
|
@ -5050,15 +5043,15 @@ fn build_diff(
|
|||
let mut old_paths = old_snapshot.entries_by_path.cursor::<PathKey>(&());
|
||||
let mut new_paths = new_snapshot.entries_by_path.cursor::<PathKey>(&());
|
||||
let mut last_newly_loaded_dir_path = None;
|
||||
old_paths.next(&());
|
||||
new_paths.next(&());
|
||||
old_paths.next();
|
||||
new_paths.next();
|
||||
for path in event_paths {
|
||||
let path = PathKey(path.clone());
|
||||
if old_paths.item().map_or(false, |e| e.path < path.0) {
|
||||
old_paths.seek_forward(&path, Bias::Left, &());
|
||||
old_paths.seek_forward(&path, Bias::Left);
|
||||
}
|
||||
if new_paths.item().map_or(false, |e| e.path < path.0) {
|
||||
new_paths.seek_forward(&path, Bias::Left, &());
|
||||
new_paths.seek_forward(&path, Bias::Left);
|
||||
}
|
||||
loop {
|
||||
match (old_paths.item(), new_paths.item()) {
|
||||
|
@ -5074,7 +5067,7 @@ fn build_diff(
|
|||
match Ord::cmp(&old_entry.path, &new_entry.path) {
|
||||
Ordering::Less => {
|
||||
changes.push((old_entry.path.clone(), old_entry.id, Removed));
|
||||
old_paths.next(&());
|
||||
old_paths.next();
|
||||
}
|
||||
Ordering::Equal => {
|
||||
if phase == EventsReceivedDuringInitialScan {
|
||||
|
@ -5100,8 +5093,8 @@ fn build_diff(
|
|||
changes.push((new_entry.path.clone(), new_entry.id, Updated));
|
||||
}
|
||||
}
|
||||
old_paths.next(&());
|
||||
new_paths.next(&());
|
||||
old_paths.next();
|
||||
new_paths.next();
|
||||
}
|
||||
Ordering::Greater => {
|
||||
let is_newly_loaded = phase == InitialScan
|
||||
|
@ -5113,13 +5106,13 @@ fn build_diff(
|
|||
new_entry.id,
|
||||
if is_newly_loaded { Loaded } else { Added },
|
||||
));
|
||||
new_paths.next(&());
|
||||
new_paths.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
(Some(old_entry), None) => {
|
||||
changes.push((old_entry.path.clone(), old_entry.id, Removed));
|
||||
old_paths.next(&());
|
||||
old_paths.next();
|
||||
}
|
||||
(None, Some(new_entry)) => {
|
||||
let is_newly_loaded = phase == InitialScan
|
||||
|
@ -5131,7 +5124,7 @@ fn build_diff(
|
|||
new_entry.id,
|
||||
if is_newly_loaded { Loaded } else { Added },
|
||||
));
|
||||
new_paths.next(&());
|
||||
new_paths.next();
|
||||
}
|
||||
(None, None) => break,
|
||||
}
|
||||
|
@ -5380,7 +5373,7 @@ impl<'a> Traversal<'a> {
|
|||
start_path: &Path,
|
||||
) -> Self {
|
||||
let mut cursor = snapshot.entries_by_path.cursor(&());
|
||||
cursor.seek(&TraversalTarget::path(start_path), Bias::Left, &());
|
||||
cursor.seek(&TraversalTarget::path(start_path), Bias::Left);
|
||||
let mut traversal = Self {
|
||||
snapshot,
|
||||
cursor,
|
||||
|
@ -5407,14 +5400,13 @@ impl<'a> Traversal<'a> {
|
|||
include_ignored: self.include_ignored,
|
||||
},
|
||||
Bias::Left,
|
||||
&(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn advance_to_sibling(&mut self) -> bool {
|
||||
while let Some(entry) = self.cursor.item() {
|
||||
self.cursor
|
||||
.seek_forward(&TraversalTarget::successor(&entry.path), Bias::Left, &());
|
||||
.seek_forward(&TraversalTarget::successor(&entry.path), Bias::Left);
|
||||
if let Some(entry) = self.cursor.item() {
|
||||
if (self.include_files || !entry.is_file())
|
||||
&& (self.include_dirs || !entry.is_dir())
|
||||
|
@ -5432,7 +5424,7 @@ impl<'a> Traversal<'a> {
|
|||
return false;
|
||||
};
|
||||
self.cursor
|
||||
.seek(&TraversalTarget::path(parent_path), Bias::Left, &())
|
||||
.seek(&TraversalTarget::path(parent_path), Bias::Left)
|
||||
}
|
||||
|
||||
pub fn entry(&self) -> Option<&'a Entry> {
|
||||
|
@ -5451,7 +5443,7 @@ impl<'a> Traversal<'a> {
|
|||
|
||||
pub fn end_offset(&self) -> usize {
|
||||
self.cursor
|
||||
.end(&())
|
||||
.end()
|
||||
.count(self.include_files, self.include_dirs, self.include_ignored)
|
||||
}
|
||||
}
|
||||
|
@ -5544,7 +5536,7 @@ impl<'a> SeekTarget<'a, EntrySummary, TraversalProgress<'a>> for TraversalTarget
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> SeekTarget<'a, PathSummary<Unit>, TraversalProgress<'a>> for TraversalTarget<'_> {
|
||||
impl<'a> SeekTarget<'a, PathSummary<&'static ()>, TraversalProgress<'a>> for TraversalTarget<'_> {
|
||||
fn cmp(&self, cursor_location: &TraversalProgress<'a>, _: &()) -> Ordering {
|
||||
self.cmp_progress(cursor_location)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue