id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_507900 | rust_dataset.txt | 507,900 | 512 | Bag,
entries_by_path: SumTree<Entry>,
entries_by_id: SumTree<PathEntry>,
root_repo_common_dir: Option<Arc<SanitizedPath>>,
root_repo_is_linked_worktree: bool,
root_repo_work_directory: Option<Arc<SanitizedPath>>,
root_repo_source_common_dir: Option<Arc<SanitizedPath>>,
/// A number that inc... |
rust_dataset_chunk_507901 | rust_dataset.txt | 507,901 | 512 | _with(relative_path),
WorkDirectory::AboveProject { .. } => true,
}
}
}
impl Default for WorkDirectory {
fn default() -> Self {
Self::InProject {
relative_path: Arc::from(RelPath::empty()),
}
}
}
#[derive(Clone)]
pub struct LocalSnapshot {
snapshot: Snap... |
rust_dataset_chunk_507902 | rust_dataset.txt | 507,902 | 512 | share their inode (and usually mtime)
/// with the symlink target, so an inode may correspond to several entries.
/// The path index allows an exact match to take precedence over the
/// inode-based rename heuristics in that case.
#[derive(Default)]
struct RemovedEntries {
current: RemovedEntriesGeneration,
pr... |
rust_dataset_chunk_507903 | rust_dataset.txt | 507,903 | 512 | && o.get().id == removed.id
{
o.remove();
}
Some(removed)
}
fn take_by_inode(&mut self, inode: u64) -> Option<Entry> {
let removed = self.by_inode.remove(&inode)?;
if let hash_map::Entry::Occupied(o) = self.by_path.entry(removed.path.clone())
... |
rust_dataset_chunk_507904 | rust_dataset.txt | 507,904 | 512 | _key().0,
item_summary: sum_tree::NoSummary,
}
}
}
impl KeyedItem for LocalRepositoryEntry {
type Key = PathKey;
fn key(&self) -> Self::Key {
self.work_directory.path_key()
}
}
impl Deref for LocalRepositoryEntry {
type Target = WorkDirectory;
fn deref(&self) -> &... |
rust_dataset_chunk_507905 | rust_dataset.txt | 507,905 | 512 | (|| {
format!(
"failed to open local worktree root at {}",
abs_path.display()
)
})
.log_err()
} else {
None
};
let root_repo_metadata = if visible {
di... |
rust_dataset_chunk_507906 | rust_dataset.txt | 507,906 | 512 | EntryKind::UnloadedDir;
}
} else {
if let Some(file_name) = abs_path.file_name()
&& let Some(file_name) = file_name.to_str()
&& let Ok(path) = RelPath::from_unix_str(file_name)
{
... |
rust_dataset_chunk_507907 | rust_dataset.txt | 507,907 | 512 | mut background_updates_rx) =
mpsc::unbounded::<proto::UpdateWorktree>();
let (mut snapshot_updated_tx, mut snapshot_updated_rx) = watch::channel();
let worktree_id = snapshot.id();
let settings_location = Some(SettingsLocation {
worktree_id,
... |
rust_dataset_chunk_507908 | rust_dataset.txt | 507,908 | 512 | .lock();
// Replace the snapshot, keeping the previous one around so we can
// resolve the paths of removed entries (the new snapshot no longer
// contains them, and the wire format only carries their ids).
l... |
rust_dataset_chunk_507909 | rust_dataset.txt | 507,909 | 512 | pub fn as_local(&self) -> Option<&LocalWorktree> {
if let Worktree::Local(worktree) = self {
Some(worktree)
} else {
None
}
}
pub fn as_remote(&self) -> Option<&RemoteWorktree> {
if let Worktree::Remote(worktree) = self {
Some(worktree)
... |
rust_dataset_chunk_507910 | rust_dataset.txt | 507,910 | 512 | worktree.snapshot.completed_scan_id,
Worktree::Remote(worktree) => worktree.snapshot.completed_scan_id,
}
}
pub fn is_visible(&self) -> bool {
match self {
Worktree::Local(worktree) => worktree.visible,
Worktree::Remote(worktree) => worktree.visible,
... |
rust_dataset_chunk_507911 | rust_dataset.txt | 507,911 | 512 | => this.update_observer.is_some(),
}
}
pub fn load_file(&self, path: &RelPath, cx: &Context<Worktree>) -> Task<Result<LoadedFile>> {
match self {
Worktree::Local(this) => this.load_file(path, cx),
Worktree::Remote(_) => {
Task::ready(Err(anyhow!("remote ... |
rust_dataset_chunk_507912 | rust_dataset.txt | 507,912 | 512 | tree.as_remote_mut().unwrap().insert_entry(
entry,
response.worktree_scan_id as usize,
cx,
)
})?
.await
... |
rust_dataset_chunk_507913 | rust_dataset.txt | 507,913 | 512 | => this.restore_entry(trash_id, cx),
}
}
fn get_children_ids_recursive(&self, path: &RelPath, ids: &mut Vec<ProjectEntryId>) {
let children_iter = self.child_entries(path);
for child in children_iter {
ids.push(child.id);
self.get_children_ids_recursive(&child.p... |
rust_dataset_chunk_507914 | rust_dataset.txt | 507,914 | 512 | .await?;
Ok(())
}))
}
}
}
pub async fn handle_create_entry(
this: Entity<Self>,
request: proto::CreateProjectEntry,
mut cx: AsyncApp,
) -> Result<proto::ProjectEntryResponse> {
let (scan_id, entry) = this.update(&mut c... |
rust_dataset_chunk_507915 | rust_dataset.txt | 507,915 | 512 | .
#[allow(deprecated)]
let task = if request.use_trash {
this.trash_entry(ProjectEntryId::from_proto(request.entry_id), cx)
.map(|task| cx.background_spawn(async move { task.await.map(|_| ()) }))
} else {
this.delete_entry(ProjectEn... |
rust_dataset_chunk_507916 | rust_dataset.txt | 507,916 | 512 | .await?;
let scan_id = this.read_with(&cx, |this, _| this.scan_id());
Ok(proto::ExpandAllForProjectEntryResponse {
worktree_scan_id: scan_id as u64,
})
}
pub fn is_single_file(&self) -> bool {
self.root_dir().is_none()
}
/// For visible worktrees, returns t... |
rust_dataset_chunk_507917 | rust_dataset.txt | 507,917 | 512 | | entry.is_always_included)
.map(|entry| entry.path.clone())
.collect::<Vec<_>>();
log::debug!(
"refreshing entries for the following always included paths: {:?}",
always_included_entries
);
// Cleans up old always included entries to ensure they ... |
rust_dataset_chunk_507918 | rust_dataset.txt | 507,918 | 512 | _prefixes_to_scan: Default::default(),
paths_to_scan: Default::default(),
removed_entries: RemovedEntries::default(),
changed_paths: Default::default(),
}),
phase: BackgroundScannerPhase::InitialScan,
... |
rust_dataset_chunk_507919 | rust_dataset.txt | 507,919 | 512 | })
{
new_snapshot.root_repo_common_dir = Some(common_dir);
new_snapshot.root_repo_is_linked_worktree = is_linked_worktree;
new_snapshot.root_repo_work_directory = Some(work_directory);
new_snapshot.root_repo_source_common_dir = source_common_dir;
... |
rust_dataset_chunk_507920 | rust_dataset.txt | 507,920 | 512 | new_entry_id, new_repo)), Some((old_entry_id, old_repo))) => {
match Ord::cmp(&new_entry_id, &old_entry_id) {
Ordering::Less => {
changes.push(UpdatedGitRepository {
work_directory_id: new_entry_id,
... |
rust_dataset_chunk_507921 | rust_dataset.txt | 507,921 | 512 | : None,
repository_dir_abs_path: None,
common_dir_abs_path: None,
});
old_repos.next();
}
}
}
(Some((entry_id, repo)), None)... |
rust_dataset_chunk_507922 | rust_dataset.txt | 507,922 | 512 | , (scan_id, tx)),
}
}
async move {
rx.await?;
Ok(())
}
}
pub fn snapshot(&self) -> LocalSnapshot {
self.snapshot.clone()
}
pub fn settings(&self) -> WorktreeSettings {
self.settings.clone()
}
fn load_binary_file(
... |
rust_dataset_chunk_507923 | rust_dataset.txt | 507,923 | 512 | 64GB for a 10GB file
// Therefore, as a temporary workaround to prevent system freezes, we just bail before opening a file
// if it is too large
// 5GB seems to be more reasonable, peaking at ~16GB, while 6GB jumps up to >24GB which seems like a
// ... |
rust_dataset_chunk_507924 | rust_dataset.txt | 507,924 | 512 | empty_arc())
}
pub fn create_entry(
&self,
path: Arc<RelPath>,
is_dir: bool,
content: Option<Vec<u8>>,
cx: &Context<Worktree>,
) -> Task<Result<CreatedEntry>> {
let abs_path = self.absolutize(&path);
let path_excluded = self.settings.is_path_excluded(... |
rust_dataset_chunk_507925 | rust_dataset.txt | 507,925 | 512 | = self.is_path_private(&path);
let abs_path = self.absolutize(&path);
let write = cx.background_spawn({
let fs = fs.clone();
let abs_path = abs_path.clone();
async move {
// For UTF-8, use the optimized `fs.save` which writes Rope chunks directly to ... |
rust_dataset_chunk_507926 | rust_dataset.txt | 507,926 | 512 | , entry: Entry, cx: &Context<Worktree>) -> Task<Result<TrashId>> {
let abs_path = self.absolutize(&entry.path);
let fs = self.fs.clone();
cx.spawn(async move |this, cx| {
let trash_id = if entry.is_file() {
fs.trash(&abs_path, Default::default()).await?
}... |
rust_dataset_chunk_507927 | rust_dataset.txt | 507,927 | 512 | })?
.await?
.context("Entry not found after restore")?;
Ok(entry)
})
}
pub fn copy_external_entries(
&self,
target_directory: Arc<RelPath>,
paths: Vec<Arc<Path>>,
cx: &Context<Worktree>,
) -> Task<Result<Ve... |
rust_dataset_chunk_507928 | rust_dataset.txt | 507,928 | 512 | (cx.read_entity(&this, |this, _| {
paths_to_refresh
.iter()
.filter_map(|path| Some(this.entry_for_path(path)?.id))
.collect()
}))
})
}
fn expand_entry(
&self,
entry_id: ProjectEntryId,
cx: &... |
rust_dataset_chunk_507929 | rust_dataset.txt | 507,929 | 512 | old_path.clone(), path.clone()]
} else {
vec![path.clone()]
};
let t0 = Instant::now();
let mut refresh = self.refresh_entries_for_paths(paths);
// todo(lw): Hot foreground spawn
cx.spawn(async move |this, cx| {
refresh.recv().await;
lo... |
rust_dataset_chunk_507930 | rust_dataset.txt | 507,930 | 512 | ,
resume_updates: resume_updates_tx,
_maintain_remote_snapshot,
});
}
pub fn share_private_files(&mut self, cx: &Context<Worktree>) {
self.share_private_files = true;
self.restart_background_scanners(cx);
}
pub fn update_abs_path_and_refresh(
&mu... |
rust_dataset_chunk_507931 | rust_dataset.txt | 507,931 | 512 | (tx, mut rx) = mpsc::unbounded();
let initial_update = self
.snapshot
.build_initial_update(project_id, self.id().to_proto());
self.update_observer = Some(tx);
cx.spawn(async move |this, cx| {
let mut update = initial_update;
'outer: loop {
... |
rust_dataset_chunk_507932 | rust_dataset.txt | 507,932 | 512 | .snapshot = snapshot.clone();
entry
})?
})
}
fn trash_entry(
&self,
entry_id: ProjectEntryId,
cx: &Context<Worktree>,
) -> Task<Result<TrashId>> {
let response = self.client.request(proto::TrashProjectEntry {
project_id: self.p... |
rust_dataset_chunk_507933 | rust_dataset.txt | 507,933 | 512 | self.client.request(proto::RestoreProjectEntry {
project_id,
worktree_id,
trash_id,
});
cx.spawn(async move |this, cx| {
let response = request.await?;
let scan_id = response.worktree_scan_id as usize;
let proto_entry = response.e... |
rust_dataset_chunk_507934 | rust_dataset.txt | 507,934 | 512 | requests.dedup();
let mut copied_entry_ids = Vec::new();
for request in requests {
let response = client.request(request).await?;
copied_entry_ids.extend(response.entry.map(|e| ProjectEntryId::from_proto(e.id)));
}
Ok(copied_e... |
rust_dataset_chunk_507935 | rust_dataset.txt | 507,935 | 512 | _directory(&self) -> Option<&Arc<Path>> {
self.root_repo_work_directory
.as_ref()
.map(SanitizedPath::cast_arc_ref)
}
pub fn root_repo_source_common_dir(&self) -> Option<&Arc<Path>> {
self.root_repo_source_common_dir
.as_ref()
.map(SanitizedPath::... |
rust_dataset_chunk_507936 | rust_dataset.txt | 507,936 | 512 | -> bool {
self.entries_by_id.get(&entry_id, ()).is_some()
}
fn insert_entry(
&mut self,
entry: proto::Entry,
always_included_paths: &PathMatcher,
) -> Result<Entry> {
let entry = Entry::try_from((&self.root_char_bag, always_included_paths, entry))?;
let old_... |
rust_dataset_chunk_507937 | rust_dataset.txt | 507,937 | 512 | _str(&update.root_name).log_err() {
self.update_abs_path(
SanitizedPath::new_arc(&Path::new(&update.abs_path)),
root_name.into(),
);
}
let mut entries_by_path_edits = Vec::new();
let mut entries_by_id_edits = Vec::new();
for entry... |
rust_dataset_chunk_507938 | rust_dataset.txt | 507,938 | 512 | _last_update {
self.completed_scan_id = update.scan_id as usize;
}
}
pub fn entry_count(&self) -> usize {
self.entries_by_path.summary().count
}
pub fn visible_entry_count(&self) -> usize {
self.entries_by_path.summary().non_ignored_count
}
pub fn dir_count... |
rust_dataset_chunk_507939 | rust_dataset.txt | 507,939 | 512 | _from_offset(true, true, include_ignored, start)
}
pub fn paths(&self) -> impl Iterator<Item = &RelPath> {
self.entries_by_path
.cursor::<()>(())
.filter(move |entry| !entry.path.is_empty())
.map(|entry| entry.path.as_ref())
}
pub fn child_entries<'a>(&'a se... |
rust_dataset_chunk_507940 | rust_dataset.txt | 507,940 | 512 | until explicitly
/// expanded, so when `path` has no entry this falls back to the ignore
/// status of its nearest scanned ancestor.
pub fn is_path_ignored(&self, path: &RelPath) -> bool {
path.ancestors()
.find_map(|ancestor| self.entry_for_path(ancestor))
.is_some_and(|ent... |
rust_dataset_chunk_507941 | rust_dataset.txt | 507,941 | 512 | {
let mut query = abs_path;
loop {
let (canonical, relative) = self
.external_canonical_to_relative
.range::<Path, _>((Bound::Unbounded, Bound::Included(query)))
.next_back()?;
if let Ok(suffix) = abs_path.strip_prefix(canonical) {... |
rust_dataset_chunk_507942 | rust_dataset.txt | 507,942 | 512 | _linked_worktree: self.root_repo_is_linked_worktree,
updated_entries,
removed_entries,
scan_id: self.scan_id as u64,
is_last_update: self.completed_scan_id == self.scan_id,
// Sent in separate messages.
updated_repositories: Vec::new(),
... |
rust_dataset_chunk_507943 | rust_dataset.txt | 507,943 | 512 | new();
let mut repo_excludes = Vec::new();
let mut repo_root = None;
for (index, ancestor) in abs_path.ancestors().enumerate() {
if index > 0 {
if let Some((ignore, _)) = self.ignores_by_parent_abs_path.get(ancestor) {
new_ignores.push((ancestor, S... |
rust_dataset_chunk_507944 | rust_dataset.txt | 507,944 | 512 | .append(IgnoreKind::Gitignore(parent_abs_path.into()), ignore);
}
}
if ignore_stack.is_abs_path_ignored(abs_path, is_dir) {
ignore_stack = IgnoreStack::all();
}
ignore_stack
}
#[cfg(feature = "test-support")]
pub fn expanded_entries(&self, file_scan... |
rust_dataset_chunk_507945 | rust_dataset.txt | 507,945 | 512 | while let Some(path) = stack.pop() {
bfs_paths.push(path);
let ix = stack.len();
for child_entry in self.child_entries(path) {
stack.insert(ix, &child_entry.path);
}
}
let dfs_paths_via_iter = self
.entries_by_path
... |
rust_dataset_chunk_507946 | rust_dataset.txt | 507,946 | 512 | {
ancestor_inodes.insert(entry.inode);
scan_job_tx
.try_send(ScanJob {
abs_path,
path,
ignore_stack,
scan_queue: scan_job_tx.clone(),
ancestor_inodes,
is_exter... |
rust_dataset_chunk_507947 | rust_dataset.txt | 507,947 | 512 | : Entry, fs: &dyn Fs, watcher: &dyn Watcher) -> Entry {
let entry = self.snapshot.insert_entry(entry, fs).await;
if entry.path.file_name() == Some(&DOT_GIT) {
self.insert_git_repository(entry.path.clone(), fs, watcher)
.await;
}
#[cfg(feature = "test-support"... |
rust_dataset_chunk_507948 | rust_dataset.txt | 507,948 | 512 | self.snapshot.check_invariants(false);
}
fn remove_path_from_snapshot_and_unwatch(
&mut self,
path: &RelPath,
watcher: &dyn Watcher,
preserve_repository_watches: bool,
) {
// When the caller preserves repository watches, the removal must not
// prune ... |
rust_dataset_chunk_507949 | rust_dataset.txt | 507,949 | 512 | ());
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;
let mut removed_i... |
rust_dataset_chunk_507950 | rust_dataset.txt | 507,950 | 512 | dyn Watcher,
) {
let work_dir_path: Arc<RelPath> = match dot_git_path.parent() {
Some(parent_dir) => {
// Guard against repositories inside the repository metadata
if parent_dir
.components()
.any(|component| component == DO... |
rust_dataset_chunk_507951 | rust_dataset.txt | 507,951 | 512 | _abs_path, fs, watcher).await;
if repository_dir_abs_path != common_dir_abs_path {
watch_git_dir_subdirectories(&repository_dir_abs_path, fs, watcher).await;
}
let work_directory_id = work_dir_entry.id;
let source_common_dir_abs_path = if work_directory.path_key().0.is_empty(... |
rust_dataset_chunk_507952 | rust_dataset.txt | 507,952 | 512 |
.git_repositories
.get(&work_directory_id)
.map_or(0, |existing_repository| existing_repository.git_dir_scan_id);
let local_repository = LocalRepositoryEntry {
work_directory_id,
work_directory,
work_directory_abs_path: work_directory_abs... |
rust_dataset_chunk_507953 | rust_dataset.txt | 507,953 | 512 | _iter()
.flat_map(Path::components)
{
input_dir_abs_path.push(component);
if !fs.is_dir(&input_dir_abs_path).await {
break;
}
result = result.and(
watcher
.add(&input_dir_abs_path)
... |
rust_dataset_chunk_507954 | rust_dataset.txt | 507,954 | 512 | config")).await && is_file_or_symlink(&path.join("HEAD"), fs).await
}
/// Whether the path is a file or a symlink, without resolving the link.
async fn is_file_or_symlink(path: &Path, fs: &dyn Fs) -> bool {
fs.is_file(path).await || fs.read_link(path).await.is_ok()
}
async fn build_gitignore(abs_path: &Path, fs: ... |
rust_dataset_chunk_507955 | rust_dataset.txt | 507,955 | 512 | .0.iter().map(|entry| (&entry.path, entry.id)))
.finish()
}
}
impl fmt::Debug for EntriesById<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.0.iter()).finish()
}
}
f.de... |
rust_dataset_chunk_507956 | rust_dataset.txt | 507,956 | 512 | to_proto(),
entry_id: self.entry_id.map(|id| id.to_proto()),
path: self.path.as_ref().as_unix_str().to_owned(),
mtime: self.disk_state.mtime().map(|time| time.into()),
is_deleted: self.disk_state.is_deleted(),
is_historic: matches!(self.disk_state, DiskState::... |
rust_dataset_chunk_507957 | rust_dataset.txt | 507,957 | 512 | ")?.id();
anyhow::ensure!(
worktree_id.to_proto() == proto.worktree_id,
"worktree id does not match file"
);
let disk_state = if proto.is_historic {
DiskState::Historic {
was_deleted: proto.is_deleted,
}
} else if proto.is... |
rust_dataset_chunk_507958 | rust_dataset.txt | 507,958 | 512 | _scan_exclusions.
pub is_always_included: bool,
/// Whether this entry's canonical path is outside of the worktree.
/// This means the entry is only accessible from the worktree root via a
/// symlink.
///
/// We only scan entries outside of the worktree once the symlinked
/// directory is ... |
rust_dataset_chunk_507959 | rust_dataset.txt | 507,959 | 512 | #[derive(Clone, Debug)]
pub struct PathProgress<'a> {
pub max_path: &'a RelPath,
}
#[derive(Clone, Debug)]
pub struct PathSummary<S> {
pub max_path: Arc<RelPath>,
pub item_summary: S,
}
impl<S: Summary> Summary for PathSummary<S> {
type Context<'a> = S::Context<'a>;
fn zero(cx: Self::Context<'_>)... |
rust_dataset_chunk_507960 | rust_dataset.txt | 507,960 | 512 | }
impl<'a, S: Summary> sum_tree::Dimension<'a, PathSummary<S>> for TraversalProgress<'a> {
fn zero(_cx: S::Context<'_>) -> Self {
Default::default()
}
fn add_summary(&mut self, summary: &'a PathSummary<S>, _: S::Context<'_>) {
self.max_path = summary.max_path.as_ref();
}
}
impl Entry ... |
rust_dataset_chunk_507961 | rust_dataset.txt | 507,961 | 512 | ;
non_ignored_file_count = non_ignored_count;
} else {
file_count = 0;
non_ignored_file_count = 0;
}
EntrySummary {
max_path: self.path.clone(),
count: 1,
non_ignored_count,
file_count,
non_ignored_f... |
rust_dataset_chunk_507962 | rust_dataset.txt | 507,962 | 512 | ) -> Self::Key {
self.id
}
}
#[derive(Clone, Debug, Default)]
struct PathEntrySummary {
max_id: ProjectEntryId,
}
impl sum_tree::ContextLessSummary for PathEntrySummary {
fn zero() -> Self {
Default::default()
}
fn add_summary(&mut self, summary: &Self) {
self.max_id = sum... |
rust_dataset_chunk_507963 | rust_dataset.txt | 507,963 | 512 | _abs_path;
let scanning_enabled;
{
let state = self.state.lock().await;
root_abs_path = state.snapshot.abs_path.clone();
scanning_enabled = state.scanning_enabled;
}
// If the worktree root does not contain a git repository, then find
// the g... |
rust_dataset_chunk_507964 | rust_dataset.txt | 507,964 | 512 | rc::new)
} else {
None
};
if is_file {
self.fs
.watch(global_gitignore_path, FS_WATCH_LATENCY)
.await
.0
} else {
Box::pin(futures::stream::pending())
}... |
rust_dataset_chunk_507965 | rust_dataset.txt | 507,965 | 512 | .watch(root_abs_path.as_path(), FS_WATCH_LATENCY)
.await;
self.watcher = watcher;
fs_events_rx = Box::pin(events.map(|events| events.into_iter().collect()));
let state = self.state.lock().await;
for target in state.symlink_paths_by_target.... |
rust_dataset_chunk_507966 | rust_dataset.txt | 507,966 | 512 | ased! {
// Process any path refresh requests from the worktree. Prioritize
// these before handling changes reported by the filesystem.
request = self.next_scan_request().fuse() => {
let Ok(request) = request else { break };
if !sel... |
rust_dataset_chunk_507967 | rust_dataset.txt | 507,967 | 512 | _check_timer.set(self.executor.timer(ROOT_PATH_CHECK_INTERVAL).fuse());
}
}
}
}
async fn process_scan_request(&self, mut request: ScanRequest, scanning: bool) -> bool {
log::debug!("rescanning paths {:?}", request.relative_paths);
{
let state = s... |
rust_dataset_chunk_507968 | rust_dataset.txt | 507,968 | 512 | .await;
self.send_status_update(scanning, request.done, &[]).await
}
fn normalized_events_for_worktree(
state: &BackgroundScannerState,
root_canonical_path: &SanitizedPath,
mut events: Vec<PathEvent>,
) -> Vec<PathEvent> {
if state.symlink_paths_by_target.is_empty(... |
rust_dataset_chunk_507969 | rust_dataset.txt | 507,969 | 512 | tree.
async fn report_root_moved_or_deleted(
&self,
root_path: &Arc<SanitizedPath>,
canonicalize_error: &anyhow::Error,
) {
let new_path = self
.state
.lock()
.await
.snapshot
.root_file_handle
.clone()
... |
rust_dataset_chunk_507970 | rust_dataset.txt | 507,970 | 512 | &mut SmallVec<[Range<usize>; 4]>, ix: usize) {
if let Some(last_range) = ranges.last_mut()
&& last_range.end == ix
{
last_range.end += 1;
} else {
ranges.push(ix..ix + 1);
}
}
// Check for events inside .gi... |
rust_dataset_chunk_507971 | rust_dataset.txt | 507,971 | 512 | ;
if self.track_git_repositories {
for ancestor in abs_path.as_path().ancestors() {
if is_dot_git(ancestor, self.fs.as_ref()).await {
let path_in_git_dir = abs_path
.as_path()
... |
rust_dataset_chunk_507972 | rust_dataset.txt | 507,972 | 512 | ignoring event {abs_path:?} for .git directory itself (kind: {:?})",
event.kind
);
if !bare_dot_git_abs_paths.contains(&dot_git_abs_path) {
bare_dot_git_abs_paths.push(dot_git_abs_path);
}
... |
rust_dataset_chunk_507973 | rust_dataset.txt | 507,973 | 512 | :?} due to rescan of {abs_path:?}"
);
dot_git_abs_paths.push(dot_git_abs_path);
}
}
}
if self.track_git_repositories
&& abs_path
.as_path()
... |
rust_dataset_chunk_507974 | rust_dataset.txt | 507,974 | 512 | casing differs from the canonical root is
// dropped. Once `fs` exposes per-volume case-sensitivity (e.g. on the
// `Fs` trait, with a per-volume cache + `FakeFs` support), fold this
// comparison on case-insensitive volumes.
let relative_path = if let Ok... |
rust_dataset_chunk_507975 | rust_dataset.txt | 507,975 | 512 | () {
return;
}
if !work_dirs_needing_exclude_update.is_empty() {
let mut state = self.state.lock().await;
for work_dir_abs_path in work_dirs_needing_exclude_update {
if let Some((_, needs_update)) = state
.snapshot
... |
rust_dataset_chunk_507976 | rust_dataset.txt | 507,976 | 512 | ignore(abs_path, self.fs.as_ref())
.await
.log_err()
.map(Arc::new);
let (prev_snapshot, ignore_stack, abs_path) = {
let mut state = self.state.lock().await;
state.snapshot.global_gitignore = ignore;
let abs_path = state.snapshot.abs_path()... |
rust_dataset_chunk_507977 | rust_dataset.txt | 507,977 | 512 | Receiver<ScanJob>,
) {
if self
.status_updates_tx
.unbounded_send(ScanState::Started)
.is_err()
{
return;
}
let progress_update_count = AtomicUsize::new(0);
self.executor
.scoped_priority(Priority::Low, |scope| {
... |
rust_dataset_chunk_507978 | rust_dataset.txt | 507,978 | 512 | _paths.is_empty() && event_roots.is_empty() && scanning {
return true;
}
let merged_event_roots = merge_event_roots(&state.changed_paths, event_roots);
let new_snapshot = state.snapshot.clone();
let old_snapshot = mem::replace(&mut state.prev_snapshot, new_snapshot.snapshot... |
rust_dataset_chunk_507979 | rust_dataset.txt | 507,979 | 512 | .await
.ok()
.map(|canonical| {
let canonical: Arc<Path> = canonical.into();
self.watcher.add(&canonical).log_err();
canonical
})
} else {
self.watcher.add(job.abs_path.as_ref()).log_err();
... |
rust_dataset_chunk_507980 | rust_dataset.txt | 507,980 | 512 | for (child_index, child_abs_path) in child_paths.into_iter().enumerate() {
let child_abs_path: Arc<Path> = child_abs_path.into();
let child_name = child_abs_path.file_name().unwrap();
let Some(child_path) = child_name
.to_str()
.and_then(|name|... |
rust_dataset_chunk_507981 | rust_dataset.txt | 507,981 | 512 | let canonical_path = match self.fs.canonicalize(&child_abs_path).await {
Ok(path) => path,
Err(err) => {
log::error!("error reading target of symlink {child_abs_path:?}: {err:#}",);
continue;
}
}... |
rust_dataset_chunk_507982 | rust_dataset.txt | 507,982 | 512 | cluded =
self.settings.is_path_always_included(&child_path, false);
}
if parent_is_private
|| (!self.share_private_files
&& self.settings.private_files.is_match(&child_entry.path))
{
log::debug!("detected privat... |
rust_dataset_chunk_507983 | rust_dataset.txt | 507,983 | 512 | >>,
) {
// grab metadata for all requested paths
let metadata = futures::future::join_all(
abs_paths
.iter()
.map(|abs_path| async move {
let metadata = self.fs.metadata(abs_path).await?;
if let Some(metadata) = meta... |
rust_dataset_chunk_507984 | rust_dataset.txt | 507,984 | 512 | let abs_path: Arc<Path> = root_abs_path.join(path.as_std_path()).into();
match metadata {
Ok(Some((metadata, canonical_path))) => {
let ignore_stack = state
.snapshot
.ignore_stack_for_abs_path(&abs_path, metadata.is_dir, s... |
rust_dataset_chunk_507985 | rust_dataset.txt | 507,985 | 512 | (&work_directory);
state
.snapshot
.repo_exclude_by_work_dir_abs_path
.insert(work_directory_abs_path.into(), (exclude, false));
}
... |
rust_dataset_chunk_507986 | rust_dataset.txt | 507,986 | 512 | select_biased! {
// Process any path refresh requests before moving on to process
// the queue of ignore statuses.
request = self.next_scan_request().fuse() => {
... |
rust_dataset_chunk_507987 | rust_dataset.txt | 507,987 | 512 | ::new(&parent_path, PathStyle::local()).log_err()
{
if *needs_update {
*needs_update = false;
if snapshot.snapshot.entry_for_path(&parent_path).is_some() {
ignores_to_update.push(parent_ab... |
rust_dataset_chunk_507988 | rust_dataset.txt | 507,988 | 512 | Job, snapshot: &LocalSnapshot) {
log::trace!("update ignore status {:?}", job.abs_path);
let mut ignore_stack = job.ignore_stack;
if let Some((ignore, _)) = snapshot.ignores_by_parent_abs_path.get(&job.abs_path) {
ignore_stack =
ignore_stack.append(IgnoreKind::Gitign... |
rust_dataset_chunk_507989 | rust_dataset.txt | 507,989 | 512 | limit.
if !entry.is_ignored
&& entry.kind.is_unloaded()
&& (was_ignored || ignore_stack.repo_root.is_some())
{
if self.should_scan_directory(&state, &entry, ignore_stack.repo_root.is_some())
{
... |
rust_dataset_chunk_507990 | rust_dataset.txt | 507,990 | 512 | known_source_common_dir_abs_path)) =
state
.snapshot
.local_repo_for_work_directory_path(RelPath::empty())
.map(|repository| {
(
repository.work_directory_id,
repository.common_dir_abs_path.c... |
rust_dataset_chunk_507991 | rust_dataset.txt | 507,991 | 512 | // ours to register. This happens legitimately when
// `.git` is a gitfile pointing outside the worktree
// (linked worktrees and submodules), and also when
// a rescan of a linked worktree's commondir arrives
// after the worktree's repos... |
rust_dataset_chunk_507992 | rust_dataset.txt | 507,992 | 512 | when we can positively confirm that its git
// directory is gone. `metadata` returns `Ok(None)` for a confirmed
// absence, but `Err(_)` for a transient failure (which can happen
// under heavy filesystem churn). Treating an error as a deletion
// makes the repository fl... |
rust_dataset_chunk_507993 | rust_dataset.txt | 507,993 | 512 | _settings_folder_name())
|| entry.path.file_name() == Some(local_vscode_folder_name())
|| state.scanned_dirs.contains(&entry.id) // If we've ever scanned it, keep scanning
|| state
.paths_to_scan
.iter()
.any(|p| p.starts_with(&entry.pa... |
rust_dataset_chunk_507994 | rust_dataset.txt | 507,994 | 512 | } else {
ancestor_dot_git.clone()
};
let dot_git_abs_path: Arc<Path> = dot_git_abs_path.as_path().into();
let (_, common_dir_abs_path) = discover_git_paths(&dot_git_abs_path, fs.as_ref()).await;
let repo_exclude_abs_path = common_dir_abs_path.... |
rust_dataset_chunk_507995 | rust_dataset.txt | 507,995 | 512 | path: path.clone(),
was_rescanned: false,
}));
merged_event_roots.extend(event_roots.cloned());
merged_event_roots
}
fn build_diff(
phase: BackgroundScannerPhase,
old_snapshot: &Snapshot,
new_snapshot: &Snapshot,
event_roots: &[EventRoot],
) -> UpdatedEntriesSet {
use Ba... |
rust_dataset_chunk_507996 | rust_dataset.txt | 507,996 | 512 | .id != new_entry.id {
changes.push((old_entry.path.clone(), old_entry.id, Removed));
changes.push((new_entry.path.clone(), new_entry.id, Added));
} else if old_entry != new_entry {
if old_entry.ki... |
rust_dataset_chunk_507997 | rust_dataset.txt | 507,997 | 512 | Path) -> CharBag {
let mut result = root_char_bag;
result.extend(path.as_unix_str().chars().map(|c| c.to_ascii_lowercase()));
result
}
#[derive(Debug)]
struct ScanJob {
abs_path: Arc<Path>,
path: Arc<RelPath>,
ignore_stack: IgnoreStack,
scan_queue: Sender<ScanJob>,
ancestor_inodes: Tree... |
rust_dataset_chunk_507998 | rust_dataset.txt | 507,998 | 512 | ::default())
.await
.unwrap();
// Check if condition is already met before waiting for events
let file_exists = || {
tree.read_with(cx, |tree, _| {
tree.entry_for_path(RelPath::from_unix_str(file_name).unwrap())
... |
rust_dataset_chunk_507999 | rust_dataset.txt | 507,999 | 512 | // for the repository to be reloaded.
#[cfg(feature = "test-support")]
fn flush_fs_events_in_root_git_repository<'a>(
&self,
cx: &'a mut gpui::TestAppContext,
) -> futures::future::LocalBoxFuture<'a, ()> {
let file_name = "fs-event-sentinel";
let tree = self.clone();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.