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_508000 | rust_dataset.txt | 508,000 | 512 | }
}
fs.remove_file(&root_path.join(file_name), Default::default())
.await
.unwrap();
// Use select to avoid blocking indefinitely if events are delayed
let mut ticks = 0;
while !tree.update(cx, |tree, _| scan_id_increased(tre... |
rust_dataset_chunk_508001 | rust_dataset.txt | 508,001 | 512 | (&self, include_files: bool, include_dirs: bool, include_ignored: bool) -> usize {
match (include_files, include_dirs, include_ignored) {
(true, true, true) => self.count,
(true, true, false) => self.non_ignored_count,
(true, false, true) => self.file_count,
(true... |
rust_dataset_chunk_508002 | rust_dataset.txt | 508,002 | 512 | traversal
}
pub fn advance(&mut self) -> bool {
self.advance_by(1)
}
pub fn advance_by(&mut self, count: usize) -> bool {
self.cursor.seek_forward(
&TraversalTarget::Count {
count: self.end_offset() + count,
include_dirs: self.include... |
rust_dataset_chunk_508003 | rust_dataset.txt | 508,003 | 512 | Path) -> Ordering {
match self {
PathTarget::Path(path) => path.cmp(&other),
PathTarget::Successor(path) => {
if other.starts_with(path) {
Ordering::Greater
} else {
Ordering::Equal
}
}
... |
rust_dataset_chunk_508004 | rust_dataset.txt | 508,004 | 512 | {
self.cmp_progress(cursor_location)
}
}
pub struct ChildEntriesOptions {
pub include_files: bool,
pub include_dirs: bool,
pub include_ignored: bool,
}
pub struct ChildEntriesIter<'a> {
parent_path: &'a RelPath,
traversal: Traversal<'a>,
}
impl<'a> Iterator for ChildEntriesIter<'a> {... |
rust_dataset_chunk_508005 | rust_dataset.txt | 508,005 | 512 | ,
path: path.into(),
inode: entry.inode,
mtime: entry.mtime.map(|time| time.into()),
size: entry.size.unwrap_or(0),
canonical_path: entry
.canonical_path
.map(|path_string| Arc::from(PathBuf::from(path_string))),
is_... |
rust_dataset_chunk_508006 | rust_dataset.txt | 508,006 | 512 | = Path::new(commondir_path.trim());
if commondir_path.is_absolute() {
commondir_path.into()
} else {
repository_dir_abs_path.join(commondir_path)
}
}
pub async fn discover_root_repo_common_dir(root_abs_path: &Path, fs: &dyn Fs) -> Option<Arc<Path>> {
discover_root_git_paths(root_abs_pa... |
rust_dataset_chunk_508007 | rust_dataset.txt | 508,007 | 512 | next()
.unwrap_or_default();
let Some(source_common_dir) = std::str::from_utf8(first_alternate)
.inspect_err(|error| {
log::debug!("ignoring the first alternate in {alternates_abs_path:?}: {error}")
})
.ok()
.and_then(|first_alternate| {
alternate_sour... |
rust_dataset_chunk_508008 | rust_dataset.txt | 508,008 | 512 | file_path(&dot_git_abs_path, parse_gitfile(&gitfile)?);
let repository_dir = Arc::<Path>::from(fs.canonicalize(&repository_dir).await?);
let commondir = if is_submodule_git_dir(&repository_dir) {
None
} else {
load_bytes_if_exists(&repository_dir.join("commondir"), fs).aw... |
rust_dataset_chunk_508009 | rust_dataset.txt | 508,009 | 512 | })
else {
return false;
};
let source_change = discover_delta_source_change(
common_dir_abs_path,
root_repository.source_common_dir_abs_path.as_ref(),
fs,
watcher,
)
.await;
matches!(source_change, DeltaSourceChange::Replaced(_))
}
fn source_common_dir_a... |
rust_dataset_chunk_508010 | rust_dataset.txt | 508,010 | 512 | = Path::new(alternate);
if !source_objects_dir.is_absolute()
|| source_objects_dir.file_name() != Some(OsStr::new(OBJECTS_DIR))
{
return None;
}
source_objects_dir.parent()
}
async fn canonicalize_existing_prefix(abs_path: &Path, fs: &dyn Fs) -> Result<PathBuf> {
for ancestor in ab... |
rust_dataset_chunk_508011 | rust_dataset.txt | 508,011 | 512 | ir_path.as_path().into();
}
}
};
(repository_dir_abs_path, common_dir_abs_path)
}
struct NullWatcher;
impl fs::Watcher for NullWatcher {
fn add(&self, _path: &Path) -> Result<()> {
Ok(())
}
fn remove(&self, _path: &Path) -> Result<()> {
Ok(())
}
}
const ST... |
rust_dataset_chunk_508012 | rust_dataset.txt | 508,012 | 512 | ()))
}
/// Streams a presumed-UTF-8 file into a [`Rope`], normalizing line endings as it
/// goes.
///
/// Returns `None` if the file turns out not to be plain UTF-8, in which case the
/// caller re-reads it and decodes it the slow way. `prefix` is the portion of
/// the file already consumed from `file` for encoding ... |
rust_dataset_chunk_508013 | rust_dataset.txt | 508,013 | 512 | prefix of validated UTF-8 is itself valid UTF-8");
// ISO-2022-JP and friends are valid UTF-8 but carry escape sequences, so
// they need the full-file encoding detector rather than this fast path.
if reject_escape_sequences && text.contains('\x1b') {
return Ok(None);
}
... |
rust_dataset_chunk_508014 | rust_dataset.txt | 508,014 | 512 | discover_root_repo_common_dir, is_dot_git, source_common_dir_after_failed_discovery,
stream_utf8_into_rope, watch_delta_source_inputs,
};
use collections::{HashMap, HashSet};
use fs::{FakeFs, Fs, RemoveOptions, RenameOptions};
use futures::{FutureExt as _, channel::mpsc};
use gpui::TestAppC... |
rust_dataset_chunk_508015 | rust_dataset.txt | 508,015 | 512 | ui::test]
async fn test_stream_utf8_block_boundaries() {
// A carriage return landing on the last byte of a block, with and
// without its newline arriving in the next one.
for (suffix, expected) in [("\r\ntail\n", "\ntail\n"), ("\rtail", "\ntail")] {
let filler = "a".repeat(STRE... |
rust_dataset_chunk_508016 | rust_dataset.txt | 508,016 | 512 | .await;
let (status_updates_tx, _status_updates_rx) = mpsc::unbounded();
let scanner = tree.update(cx, |tree, cx| {
let tree = tree.as_local_mut().unwrap();
tree._background_scanner_tasks.clear();
BackgroundScanner {
state: asy... |
rust_dataset_chunk_508017 | rust_dataset.txt | 508,017 | 512 | ("/root/removed")),
RemoveOptions {
recursive: true,
..RemoveOptions::default()
},
)
.await
.unwrap();
fs.remove_dir(Path::new(path!("/root/replaced")), RemoveOptions::default())
.awai... |
rust_dataset_chunk_508018 | rust_dataset.txt | 508,018 | 512 | (true, 0).cloned().collect::<Vec<_>>(),
expected_entries
);
assert!(ignore_jobs.is_empty());
state.snapshot.check_invariants(false);
for entry in &expected_entries {
let path_entry = state.snapshot.entries_by_id.get(&entry.id, ()).unwrap()... |
rust_dataset_chunk_508019 | rust_dataset.txt | 508,019 | 512 | .as_ref()).await);
// `config` has to resolve to a real file.
assert!(!is_dot_git(Path::new(path!("/root/dangling_config")), fs.as_ref()).await);
// A `head` directory must not be mistaken for `HEAD` on case-insensitive filesystems.
fs.set_case_sensitive(false);
assert!(!is_dot_... |
rust_dataset_chunk_508020 | rust_dataset.txt | 508,020 | 512 | ::default()
};
let failing_watcher_result = watch_delta_source_inputs(
Path::new(path!("/root/clone.git")),
fs.as_ref(),
&failing_watcher,
)
.await;
watched_paths.push(failing_watcher.added_paths.lock().clone());
let clone_input_dirs =... |
rust_dataset_chunk_508021 | rust_dataset.txt | 508,021 | 512 | ()),
] {
fs.insert_file(
Path::new(path!("/root"))
.join(clone_name)
.join("objects/info/alternates"),
alternates,
)
.await;
}
let mut source_common_dirs = Vec::new();
for clone_n... |
rust_dataset_chunk_508022 | rust_dataset.txt | 508,022 | 512 | ),
],
[
Some(root_source.clone()),
None,
Some(entry_source.clone()),
None,
None,
]
);
}
#[test]
fn test_alternate_source_common_dir() {
let objects_dir = path!("/repo/.git/obj... |
rust_dataset_chunk_508023 | rust_dataset.txt | 508,023 | 512 | <u32>,
pub private_files: PathMatcher,
pub hidden_files: PathMatcher,
pub read_only_files: PathMatcher,
}
impl WorktreeSettings {
pub fn is_path_private(&self, path: &RelPath) -> bool {
path.ancestors()
.any(|ancestor| self.private_files.is_match(ancestor))
}
pub fn is_path... |
rust_dataset_chunk_508024 | rust_dataset.txt | 508,024 | 512 | (hidden_files, "hidden_files"),
read_only_files: valid_path_matchers(read_only_files, "read_only_files"),
scan_symlinks,
file_scan_depth: worktree.file_scan_depth.filter(|depth| *depth > 0),
}
}
}
fn valid_path_matchers(mut values: Vec<String>, context: &'static str) -> ... |
rust_dataset_chunk_508025 | rust_dataset.txt | 508,025 | 512 | '^')
));
if character == ']' && index > first_content {
class_start = None;
}
} else {
match character {
'[' => class_start = Some(index),
'{' => open_braces += 1,
'}' => open_braces = open_braces... |
rust_dataset_chunk_508026 | rust_dataset.txt | 508,026 | 512 | ({ setting: patterns })).expect("override settings");
content.merge_from(&overrides);
WorktreeSettings::from_settings(&content)
}
fn assert_file_pattern_settings(setting: &str) {
for (patterns, expected) in [
(vec!["**/alpha/**", "zeta/**"], [false, true, true]),
(vec!["**/alpha/**", "[", "... |
rust_dataset_chunk_508027 | rust_dataset.txt | 508,027 | 512 | _do_not_include_parents() {
let settings =
settings_with_patterns("file_scan_inclusions", &["ignored/[", "valid/nested/**"]);
assert!(!settings.is_path_always_included(rel_path("ignored"), true));
assert!(!settings.is_path_always_included(rel_path("ignored/file.txt"), false));
assert!(settings.i... |
rust_dataset_chunk_508028 | rust_dataset.txt | 508,028 | 512 | ancestor {directory}"
);
}
for directory in ["b", "c", "unmatched"] {
assert!(
!settings.is_path_always_included(rel_path(directory), true),
"unexpected ancestor {directory}"
);
}
assert!(settings.is_path_always_included(rel_path("a/b/file.rs"), false));
... |
rust_dataset_chunk_508029 | rust_dataset.txt | 508,029 | 512 | false));
assert!(settings.is_path_always_included(rel_path("ignored/nested"), true));
assert!(settings.is_path_always_included(rel_path("ignored"), true));
}
#[cfg(not(windows))]
#[test]
fn test_inclusion_parents_preserve_character_classes() {
let settings = settings_with_patterns("file_scan_inclusions", ... |
rust_dataset_chunk_508030 | rust_dataset.txt | 508,030 | 512 | !settings.is_path_read_only(®ular_file),
"Regular files should not be read-only"
);
let similar_name = RelPath::new(Path::new("src/generator.rs"), PathStyle::local()).unwrap();
assert!(
!settings.is_path_read_only(&similar_name),
"Files with 'generator' in name but not in genera... |
rust_dataset_chunk_508031 | rust_dataset.txt | 508,031 | 512 | .js"), PathStyle::local()).unwrap();
assert!(
settings.is_path_read_only(&minified_js),
"Minified JS files should be read-only"
);
let regular_js = RelPath::new(Path::new("src/app.js"), PathStyle::local()).unwrap();
assert!(
!settings.is_path_read_only(®ular_js),
"Reg... |
rust_dataset_chunk_508032 | rust_dataset.txt | 508,032 | 512 | _| {
assert_eq!(
tree.entries(false, 0)
.map(|entry| entry.path.as_ref())
.collect::<Vec<_>>(),
vec![
rel_path(""),
rel_path(".gitignore"),
rel_path("a"),
rel_path("a/c"),
]
... |
rust_dataset_chunk_508033 | rust_dataset.txt | 508,033 | 512 | ok_or_else(|| anyhow::anyhow!("expected a local worktree"))?
.refresh_entries_for_paths(vec![
rel_path("destination.rs").into(),
rel_path("source.rs").into(),
]))
})?
.recv()
.await;
tree.read_with(cx, |tree, _| -> ... |
rust_dataset_chunk_508034 | rust_dataset.txt | 508,034 | 512 | fs.flush_events(1);
cx.executor().run_until_parked();
fs.flush_events(1);
cx.executor().run_until_parked();
tree.read_with(cx, |tree, _| {
assert_eq!(tree.entry_for_path(rel_path("one.rs")), None);
assert_eq!(
tree.entry_for_path(rel_path("three.rs")).unwrap().id,
... |
rust_dataset_chunk_508035 | rust_dataset.txt | 508,035 | 512 | !(
tree.entries(true, 0)
.map(|entry| entry.path.as_ref())
.collect::<Vec<_>>(),
vec![
rel_path(""),
rel_path("a"),
rel_path("a/b"),
rel_path("a/b/f1"),
rel_path("a/c"),
... |
rust_dataset_chunk_508036 | rust_dataset.txt | 508,036 | 512 | <_>>(),
vec![
rel_path(""),
rel_path("lib"),
rel_path("lib/a"),
rel_path("lib/a/a.txt"),
rel_path("lib/a/lib-2"),
rel_path("lib/b"),
rel_path("lib/b/b.txt"),
rel_path("lib/b/lib"),... |
rust_dataset_chunk_508037 | rust_dataset.txt | 508,037 | 512 | ::new(Vec::new()));
tree.update(cx, |_, cx| {
let tree_updates = tree_updates.clone();
cx.subscribe(&tree, move |_, _, event, _| {
if let Event::UpdatedEntries(update) = event {
tree_updates.lock().extend(
update
.iter()
... |
rust_dataset_chunk_508038 | rust_dataset.txt | 508,038 | 512 | (rel_path("deps/dep-dir3-nested"), true),
(rel_path("src"), false),
(rel_path("src/a.rs"), false),
(rel_path("src/b.rs"), false),
]
);
});
assert_eq!(
mem::take(&mut *tree_updates.lock()),
&[
(rel_pat... |
rust_dataset_chunk_508039 | rust_dataset.txt | 508,039 | 512 | deps/dep-dir3/src/f.rs").into(),
PathChange::Loaded
),
(
rel_path("deps/dep-dir3/src/nested").into(),
PathChange::Loaded
)
]
);
// After an external symlink subtree is loaded, changes in the target should be reflected.
... |
rust_dataset_chunk_508040 | rust_dataset.txt | 508,040 | 512 | "))
.is_some()
);
assert!(
tree.entry_for_path(rel_path("deps/dep-dir3-alias/src/shared-new.rs"))
.is_some()
);
});
// Create a file under the more specific nested target. Longest-prefix matching means this should appear under dep-dir3-nested
... |
rust_dataset_chunk_508041 | rust_dataset.txt | 508,041 | 512 | /subdir-aa"),
Default::default(),
)
.await
.unwrap();
wait_for_condition(cx, |cx| {
tree.read_with(cx, |tree, _| {
tree.entry_for_path(rel_path("subdir-a")).is_none()
&& tree
.entry_for_path(rel_path("subdir-aa/config.ini"))
... |
rust_dataset_chunk_508042 | rust_dataset.txt | 508,042 | 512 | /existing.rs"), false),
(rel_path("links/internal/nested"), false),
(rel_path("links/internal/nested/deep.rs"), false),
(rel_path("real-dir"), false),
(rel_path("real-dir/existing.rs"), false),
(rel_path("real-dir/nested"), false),
... |
rust_dataset_chunk_508043 | rust_dataset.txt | 508,043 | 512 | ": {
"src": {
"b.rs": "",
}
}
}),
)
.await;
fs.create_symlink("/root/dir1/deps/dep-dir2".as_ref(), "../../dir2".into())
.await
.unwrap();
let tree = Worktree::local(
Path::new("/root/dir1"),
true,
... |
rust_dataset_chunk_508044 | rust_dataset.txt | 508,044 | 512 | ();
watched_paths.sort();
assert_eq!(
watched_paths,
vec![PathBuf::from("/outside/data"), PathBuf::from("/root")]
);
fs.remove_file("/root/link".as_ref(), RemoveOptions::default())
.await
... |
rust_dataset_chunk_508045 | rust_dataset.txt | 508,045 | 512 | 0),
&mut cx.to_async(),
)
.await
.unwrap();
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
tree.read_with(cx, |tree, _| {
let snapshot = tree.as_local().unwrap().snapshot();
let lookup = |abs_path: &str| {
snapshot
... |
rust_dataset_chunk_508046 | rust_dataset.txt | 508,046 | 512 | ).as_local().unwrap().scan_complete())
.await;
// With the default scan_symlinks = Expanded, the symlinked directory
// should appear as an UnloadedDir entry with no children visible.
tree.read_with(cx, |tree, _| {
assert_eq!(
tree.entries(true, 0)
.map(|entry| (... |
rust_dataset_chunk_508047 | rust_dataset.txt | 508,047 | 512 | assert_eq!(
tree.entries(true, 0)
.map(|entry| (entry.path.as_ref(), entry.is_external))
.collect::<Vec<_>>(),
vec![
(rel_path(""), false),
(rel_path("deps"), false),
(rel_path("deps/dep-dir2"), true),
... |
rust_dataset_chunk_508048 | rust_dataset.txt | 508,048 | 512 | (rel_path("deps/ext"), true),
(rel_path("deps/ext/data.txt"), true),
(rel_path("lib"), false),
(rel_path("lib/a"), false),
(rel_path("lib/a/a.txt"), false),
]
);
});
}
#[gpui::test]
async fn test_scan_symlinks_always_respects_giti... |
rust_dataset_chunk_508049 | rust_dataset.txt | 508,049 | 512 | true),
(rel_path("deps/included-dep"), true, false),
(rel_path("deps/included-dep/src"), true, false),
(rel_path("deps/included-dep/src/included.rs"), true, false),
]
);
assert_eq!(
tree.entry_for_path(rel_path("deps/ignored-dep")... |
rust_dataset_chunk_508050 | rust_dataset.txt | 508,050 | 512 | (cx, |tree, _| {
assert_eq!(
tree.entries(true, 0)
.map(|entry| (entry.path.as_ref(), entry.is_external))
.collect::<Vec<_>>(),
vec![
(rel_path(""), false),
(rel_path("deps"), false),
(rel_path("deps/dep-exte... |
rust_dataset_chunk_508051 | rust_dataset.txt | 508,051 | 512 | assert_eq!(
tree.entry_for_path(rel_path("deps/dep-external"))
.unwrap()
.kind,
EntryKind::UnloadedDir
);
});
// Manually expand the symlinked directory. This is the case #51382 was
// added to fix; if this assertion fails it's a regre... |
rust_dataset_chunk_508052 | rust_dataset.txt | 508,052 | 512 | _entry = tree
.entry_for_path(rel_path("links/internal/existing.rs"))
.unwrap();
assert_eq!(real_entry.inode, symlink_entry.inode);
assert_eq!(real_entry.mtime, symlink_entry.mtime);
assert_ne!(real_entry.id, symlink_entry.id);
(real_entry.id, symlink_entry.id, re... |
rust_dataset_chunk_508053 | rust_dataset.txt | 508,053 | 512 | mut cx.to_async(),
)
.await
.unwrap();
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
tree.read_with(cx, |tree, _| {
assert_eq!(
tree.entries(true, 0)
.map(|entry| entry.path.as_ref())
.collect::<Vec<_>>(),
... |
rust_dataset_chunk_508054 | rust_dataset.txt | 508,054 | 512 | , _| {
assert!(tree.entry_for_path(rel_path("old.txt")).is_some());
assert!(tree.entry_for_path(rel_path("new.txt")).is_none());
});
fs.emit_fs_event("/root", Some(fs::PathEventKind::Rescan));
fs.unpause_events_and_flush();
tree.flush_fs_events(cx).await;
tree.read_with(cx, |tree, ... |
rust_dataset_chunk_508055 | rust_dataset.txt | 508,055 | 512 | target_os = "macos")))]
#[gpui::test]
async fn test_new_directory_scan_does_not_miss_event_before_adding_watcher(
cx: &mut TestAppContext,
) {
init_test(cx);
let fs = FakeFs::new(cx.background_executor.clone());
fs.insert_tree("/root", json!({})).await;
let tree = Worktree::local(
Path::ne... |
rust_dataset_chunk_508056 | rust_dataset.txt | 508,056 | 512 | = Arc::new(Mutex::new(Vec::new()));
tree.update(cx, |_, cx| {
let tree_updates = tree_updates.clone();
cx.subscribe(&tree, move |_, _, event, _| {
if let Event::UpdatedEntries(update) = event {
tree_updates.lock().extend(
update
... |
rust_dataset_chunk_508057 | rust_dataset.txt | 508,057 | 512 | },
"b": {
"b1.js": "b1",
"b2.js": "b2",
},
"c": {
"c1.js": "c1",
"c2.js": "c2",
}
},
},
... |
rust_dataset_chunk_508058 | rust_dataset.txt | 508,058 | 512 | "), true),
(rel_path("one/node_modules/c"), true),
(rel_path("two"), false),
(rel_path("two/x.js"), false),
(rel_path("two/y.js"), false),
]
);
assert_eq!(
loaded.file.path.as_ref(),
rel_path("one/node_m... |
rust_dataset_chunk_508059 | rust_dataset.txt | 508,059 | 512 | `FakeFs` does not count as directory scans.
let prev_read_dir_count = fs.read_dir_call_count();
fs.create_dir(path.as_ref()).await.unwrap();
cx.executor().run_until_parked();
assert_eq!(fs.read_dir_call_count(), prev_read_dir_count);
}
#[gpui::test]
async fn test_dirs_no_longer_ignored(cx: &mut Test... |
rust_dataset_chunk_508060 | rust_dataset.txt | 508,060 | 512 | (rel_path("b/b.js"), false),
(rel_path("node_modules"), true),
(rel_path("node_modules/c"), true),
(rel_path("node_modules/d"), true),
(rel_path("node_modules/d/d.js"), true),
(rel_path("node_modules/d/e"), true),
... |
rust_dataset_chunk_508061 | rust_dataset.txt | 508,061 | 512 | );
cx.executor().allow_parking();
let dir = TempTree::new(json!({
".git": {},
".gitignore": "ignored-dir\n",
"tracked-dir": {},
"ignored-dir": {}
}));
let worktree = Worktree::local(
dir.path(),
true,
RealFs::new(None, cx.executor()),
Defa... |
rust_dataset_chunk_508062 | rust_dataset.txt | 508,062 | 512 | },
"bar": {
"bar.rs": "// bar",
},
"lib.rs": "mod foo;\nmod bar;\n",
},
"top_level.txt": "top level file",
".DS_Store": "",
}));
cx.update(|cx| {
cx.update_global::<SettingsStore, _>(|store, cx| {
store.update_user_... |
rust_dataset_chunk_508063 | rust_dataset.txt | 508,063 | 512 | ::from(vec![
"...".to_string(),
"ignored/**/*.user".to_string(),
]));
});
store
.set_local_settings(
worktree_id,
LocalSettingsPath::InWorktree(Arc::from(RelPath::empty())),
... |
rust_dataset_chunk_508064 | rust_dataset.txt | 508,064 | 512 | env.local"),
rel_path(".gitignore"),
rel_path("ignored/nested/included.project"),
rel_path("ignored/nested/included.user"),
]
);
});
let ignored_directories = ["ignored", "ignored/nested", "one", "one/two", "three"];
for (settings, include... |
rust_dataset_chunk_508065 | rust_dataset.txt | 508,065 | 512 | Some(settings),
cx,
)
.expect("valid project settings");
});
});
cx.run_until_parked();
tree.read_with(cx, |tree, _| {
tree.as_local().expect("local worktree").scan_complete()
})
.await;
... |
rust_dataset_chunk_508066 | rust_dataset.txt | 508,066 | 512 | tree.flush_fs_events(cx).await;
tree.read_with(cx, |tree, _| {
// Assert that file_scan_inclusions overrides file_scan_exclusions.
check_worktree_entries(
tree,
WorktreeExpectations {
excluded_paths: &[".DS_Store, src/.DS_Store"],
ignored_pat... |
rust_dataset_chunk_508067 | rust_dataset.txt | 508,067 | 512 | is_some_and(|f| f.is_always_included)
);
});
cx.update(|cx| {
cx.update_global::<SettingsStore, _>(|store, cx| {
store.update_user_settings(cx, |settings| {
settings.project.worktree.file_scan_exclusions = Some(SplicingVec::from(vec![]));
settings.pro... |
rust_dataset_chunk_508068 | rust_dataset.txt | 508,068 | 512 | !({ "child.rs": "" })
} else {
json!("")
};
fs.insert_tree(
"/parent",
json!({
"config": { "target": contents },
"worktree": {
"config": { "target": contents },
"file.rs": "",
},
}),
)
.await;
fs.... |
rust_dataset_chunk_508069 | rust_dataset.txt | 508,069 | 512 | });
});
});
cx.run_until_parked();
tree.read_with(cx, |tree, _| -> Result<()> {
tree.as_local()
.ok_or_else(|| anyhow::anyhow!("expected a local worktree"))?
.snapshot()
.check_invariants(false);
let expected_entries = original_entries... |
rust_dataset_chunk_508070 | rust_dataset.txt | 508,070 | 512 | cx.executor()),
Default::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
.unwrap();
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
tree.flush_fs_events(cx).await;
tree.read_with(cx, |tree, _| {
che... |
rust_dataset_chunk_508071 | rust_dataset.txt | 508,071 | 512 | ": "logs",
},
"visible.txt": "content",
}));
let tree = Worktree::local(
dir.path(),
true,
RealFs::new(None, cx.executor()),
Default::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
.unwrap();
cx.re... |
rust_dataset_chunk_508072 | rust_dataset.txt | 508,072 | 512 | ),
(rel_path("visible.txt"), false),
]
);
});
}
#[gpui::test]
async fn test_hidden_files_from_project_settings(cx: &mut TestAppContext) {
init_test(cx);
let worktree_id = WorktreeId::from_proto(0);
let fs = FakeFs::new(cx.background_executor.clone());
fs.insert_t... |
rust_dataset_chunk_508073 | rust_dataset.txt | 508,073 | 512 | cx| {
cx.update_global::<SettingsStore, _>(|store, cx| {
store
.set_local_settings(
worktree_id,
LocalSettingsPath::InWorktree(Arc::from(RelPath::empty())),
LocalSettingsKind::Settings,
... |
rust_dataset_chunk_508074 | rust_dataset.txt | 508,074 | 512 | store.update_user_settings(cx, |settings| {
settings.project.worktree.file_scan_exclusions = Some(SplicingVec::from(vec![
"**/.git".to_string(),
"node_modules/".to_string(),
"build_output".to_string(),
]));
});
... |
rust_dataset_chunk_508075 | rust_dataset.txt | 508,075 | 512 | new_excluded_dir,
new_ignored_dir,
node_modules_dir,
dot_git_dir,
src_dir,
] {
std::fs::write(directory_for_new_file.join("new_file"), "new file contents")
.unwrap_or_else(|e| {
panic!("Failed to create in {directory_for_new_file:?} a new f... |
rust_dataset_chunk_508076 | rust_dataset.txt | 508,076 | 512 | ..Default::default()
},
)
});
std::fs::write(dot_git_worktree_dir.join("new_file"), "new file contents")
.unwrap_or_else(|e| panic!("Failed to create in {dot_git_worktree_dir:?} a new file: {e}"));
tree.flush_fs_events(cx).await;
tree.read_with(cx, |tree, _| {
check... |
rust_dataset_chunk_508077 | rust_dataset.txt | 508,077 | 512 | assert_eq!(
snapshot1.lock().entries(true, 0).collect::<Vec<_>>(),
snapshot2.entries(true, 0).collect::<Vec<_>>()
);
}
#[gpui::test]
async fn test_create_dir_all_on_create_entry(cx: &mut TestAppContext) {
init_test(cx);
cx.executor().allow_parking();
let fs_fake = FakeFs::new(cx.ba... |
rust_dataset_chunk_508078 | rust_dataset.txt | 508,078 | 512 | .is_file());
cx.executor().run_until_parked();
tree_real.read_with(cx, |tree, _| {
assert!(
tree.entry_for_path(rel_path("a/b/c/d.txt"))
.unwrap()
.is_file()
);
assert!(tree.entry_for_path(rel_path("a/b/c")).unwrap().is_dir());
assert!... |
rust_dataset_chunk_508079 | rust_dataset.txt | 508,079 | 512 | _dir": {
"existing_file.txt": "existing content",
"another_file.txt": "another content",
},
}),
)
.await;
let tree = Worktree::local(
Path::new("/root"),
true,
fs.clone(),
Default::default(),
true,
WorktreeI... |
rust_dataset_chunk_508080 | rust_dataset.txt | 508,080 | 512 | assert!(
tree.entry_for_path(rel_path("ignored_dir/new_file.txt"))
.is_some(),
"new_file.txt should be visible"
);
});
}
#[gpui::test]
async fn test_fs_event_for_gitignored_dir_does_not_lose_contents(cx: &mut TestAppContext) {
// Tests the behavior of our... |
rust_dataset_chunk_508081 | rust_dataset.txt | 508,081 | 512 | );
assert!(
tree.entry_for_path(rel_path("ignored_dir/file2.txt"))
.is_some(),
"file2.txt should still be visible after directory fs event"
);
});
}
#[gpui::test(iterations = 100)]
async fn test_random_worktree_operations_during_initial_scan(
cx: &mut Te... |
rust_dataset_chunk_508082 | rust_dataset.txt | 508,082 | 512 | ().unwrap().snapshot()));
}
}
worktree
.update(cx, |tree, _| tree.as_local_mut().unwrap().scan_complete())
.await;
cx.executor().run_until_parked();
let final_snapshot = worktree.read_with(cx, |tree, _| {
let tree = tree.as_local().unwrap();
let snapshot = tree... |
rust_dataset_chunk_508083 | rust_dataset.txt | 508,083 | 512 | _mut().unwrap().observe_updates(0, cx, {
let updates = updates.clone();
move |update| {
updates.lock().push(update);
async { true }
}
});
});
worktree
.update(cx, |tree, _| tree.as_local_mut().unwrap().scan_complete())
... |
rust_dataset_chunk_508084 | rust_dataset.txt | 508,084 | 512 | map(|e| e.path.clone())
.collect::<Vec<_>>();
{
let new_worktree = Worktree::local(
root_dir,
true,
fs.clone(),
Default::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
... |
rust_dataset_chunk_508085 | rust_dataset.txt | 508,085 | 512 | unwrap_or(40);
let root_dir = Path::new(path!("/test"));
let dot_git = root_dir.join(".git");
// Random fs mutations are confined to this subdirectory so that they
// cannot rename or delete `.git` itself.
let src_dir = root_dir.join("src");
let fs = FakeFs::new(cx.background_executor.clone()) ... |
rust_dataset_chunk_508086 | rust_dataset.txt | 508,086 | 512 | commit_count}"),
);
pending_git_update.set(true);
}
// The watch queue overflows: all undelivered events are lost and
// only a rescan for the root is reported.
25..40 => {
log::info!(
"simulating watcher... |
rust_dataset_chunk_508087 | rust_dataset.txt | 508,087 | 512 | existing_entry = entries.get_mut(ix).unwrap();
assert_eq!(existing_entry.path, entry.path);
*existing_entry = entry;
}
PathChange::AddedOrUpdated | PathChange::Loaded => {
let entry = entry.unwrap();
... |
rust_dataset_chunk_508088 | rust_dataset.txt | 508,088 | 512 | task.await?;
Ok(())
})
}
}
}
}
async fn randomly_mutate_fs(
fs: &Arc<dyn Fs>,
root_path: &Path,
insertion_probability: f64,
rng: &mut impl Rng,
) {
log::info!("mutating fs");
let mut files = Vec::new();
let mut dirs = Vec::new();
... |
rust_dataset_chunk_508089 | rust_dataset.txt | 508,089 | 512 | log::info!(
"creating gitignore {:?} with contents:\n{}",
ignore_path.strip_prefix(root_path).unwrap(),
ignore_contents
);
fs.save(
&ignore_path,
&ignore_contents.as_str().into(),
Default::default(),
)
.await... |
rust_dataset_chunk_508090 | rust_dataset.txt | 508,090 | 512 | .map(|_| rng.sample(rand::distr::Alphanumeric))
.map(char::from)
.collect()
}
#[gpui::test]
async fn test_private_single_file_worktree(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.background_executor.clone());
fs.insert_tree("/", json!({".env": "PRIVATE=secret\n... |
rust_dataset_chunk_508091 | rust_dataset.txt | 508,091 | 512 | worktree.as_local().unwrap().repositories()
});
pretty_assertions::assert_eq!(repos, [Path::new(path!("/root")).into()]);
}
#[gpui::test]
async fn test_global_gitignore(executor: BackgroundExecutor, cx: &mut TestAppContext) {
init_test(cx);
let home = paths::home_dir();
let project_path = home.jo... |
rust_dataset_chunk_508092 | rust_dataset.txt | 508,092 | 512 | , |worktree, _cx| {
check_worktree_entries(
worktree,
WorktreeExpectations {
ignored_paths: &["bar", "subrepo/bar"],
tracked_paths: &["foo", "sub/bar", "baz"],
..Default::default()
},
);
});
// Statuses are upda... |
rust_dataset_chunk_508093 | rust_dataset.txt | 508,093 | 512 | .
worktree.update(cx, |worktree, _cx| {
check_worktree_entries(
worktree,
WorktreeExpectations {
ignored_paths: &["foo"],
tracked_paths: &["keep_me"],
..Default::default()
},
);
});
}
#[gpui::test]
async fn test... |
rust_dataset_chunk_508094 | rust_dataset.txt | 508,094 | 512 | scratch" }
},
"src": {
"main.rs": "fn main() {}",
}
}),
)
.await;
let worktree = Worktree::local(
path!("/scratch/proj").as_ref(),
true,
fs.clone(),
Default::default(),
true,
WorktreeId::from_proto(0... |
rust_dataset_chunk_508095 | rust_dataset.txt | 508,095 | 512 | ignored_paths: &[".env.local"],
tracked_paths: &[".env.example", "README.md", "src/main.rs"],
..Default::default()
},
);
});
// Ignore statuses are updated when .git/info/exclude file changes
fs.write(
&project_dir.join(DOT_GIT).jo... |
rust_dataset_chunk_508096 | rust_dataset.txt | 508,096 | 512 | ignored_paths: &["vendor/cache"],
tracked_paths: &["vendor/keep.txt", "elsewhere/vendor/cache"],
..Default::default()
},
);
});
}
#[gpui::test]
async fn test_repo_exclude_applies_within_nested_repos(
executor: BackgroundExecutor,
cx: &mut ... |
rust_dataset_chunk_508097 | rust_dataset.txt | 508,097 | 512 | tree_entries(
worktree,
WorktreeExpectations {
ignored_paths: &[".scratch/clones", ".scratch/worktrees"],
tracked_paths: &["src/main.rs"],
..Default::default()
},
);
});
// Load a file within the excluded nested reposit... |
rust_dataset_chunk_508098 | rust_dataset.txt | 508,098 | 512 | | entry.path.clone())
.collect::<Vec<_>>();
assert_eq!(
unignored_entries,
Vec::<Arc<RelPath>>::new(),
"entries under the excluded .scratch directories leaked into the unignored traversal",
);
});
}
#[derive(Default)]
struct WorktreeExpectations {
... |
rust_dataset_chunk_508099 | rust_dataset.txt | 508,099 | 512 | \n",
"info": {
"exclude": "ignored.txt\n",
},
"worktrees": {
"feature-a": {
"HEAD": "ref: refs/heads/feature-a",
"commondir": "../..",
"gitdir": "/repo/feature-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.