C1: alpha dry run fixes (Ctrl+C in terminal, ignored colour, find singular)
- Terminal: undo an inherited "ignore Ctrl+C" flag before starting a ConPTY shell (lutra_proc::enable_ctrl_c). Lutra started by the lutra CLI (CREATE_NEW_PROCESS_GROUP) passed it to every shell, so Ctrl+C stopped nothing. Test reruns itself with that flag. - Engine: an edited .gitignore/.ignore reports TreeChanged for its folder, so the tree greys newly ignored files (Add to .gitignore). - Find: "1 match", "1 file" instead of "1 files". - docs/alpha-checklist.md: steps corrected after the Windows dry run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
30de747ad6
commit
e228d11ef9
11 changed files with 173 additions and 20 deletions
|
|
@ -234,9 +234,18 @@ pub fn sync_buffer_dirs(state: &mut State) {
|
|||
workspace.pin_dirs(dirs);
|
||||
}
|
||||
|
||||
/// Whether `path` is an ignore file (`.gitignore`, `.ignore`) whose rules
|
||||
/// decide the `ignored` flag of the entries listed next to it.
|
||||
fn is_ignore_file(path: &Path) -> bool {
|
||||
path.file_name()
|
||||
.is_some_and(|name| name == ".gitignore" || name == ".ignore")
|
||||
}
|
||||
|
||||
/// Applies pending changes on disk to the state: hands them to the symbol
|
||||
/// index ([`crate::cmd::goto::note_disk_changes`]), queues
|
||||
/// [`Event::TreeChanged`] for affected directories, reloads clean buffers
|
||||
/// [`Event::TreeChanged`] for affected directories (also for the directory
|
||||
/// of an edited ignore file, whose entries may change their `ignored`
|
||||
/// flag), reloads clean buffers
|
||||
/// whose file changed, and queues [`Event::FileChangedOnDisk`] for dirty
|
||||
/// buffers and for buffers whose file disappeared.
|
||||
pub fn pump(state: &mut State) {
|
||||
|
|
@ -268,7 +277,12 @@ pub fn pump(state: &mut State) {
|
|||
add_dir(&to);
|
||||
gone.push(from);
|
||||
}
|
||||
VfsEvent::Modified { path } => modified.push(path),
|
||||
VfsEvent::Modified { path } => {
|
||||
if is_ignore_file(&path) {
|
||||
add_dir(&path);
|
||||
}
|
||||
modified.push(path);
|
||||
}
|
||||
VfsEvent::Failed(_) => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,6 +381,29 @@ fn tree_changes_are_reported_for_listed_directories() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn editing_gitignore_reports_its_directory_with_the_new_ignored_flag() {
|
||||
let (dir, mut engine, _) = open_project(&[(".gitignore", b"/var/\n"), ("notes.txt", b"note")]);
|
||||
let ignored = |engine: &mut Engine| {
|
||||
let listing = run(engine, "project.children", json!({"dir": ""})).value;
|
||||
listing["entries"]
|
||||
.as_array()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find(|e| e["name"] == "notes.txt")
|
||||
.unwrap()["ignored"]
|
||||
.as_bool()
|
||||
.unwrap()
|
||||
};
|
||||
assert!(!ignored(&mut engine));
|
||||
fs::write(dir.path().join(".gitignore"), "/var/\n/notes.txt\n").unwrap();
|
||||
wait_for(
|
||||
&mut engine,
|
||||
|e| matches!(e, Event::TreeChanged { dir } if dir.is_empty()),
|
||||
);
|
||||
assert!(ignored(&mut engine));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn watched_directories_are_capped_least_recently_listed_first() {
|
||||
let (dir, mut engine, _) = open_project(&[]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue