Skip to content

Commit bf9a189

Browse files
committed
with-watch: keep fd extension searches pattern-only
1 parent 8dd8aa0 commit bf9a189

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

crates/with-watch/src/analysis.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,6 @@ fn analyze_fd(
19061906
let mut base_dir: Option<String> = None;
19071907
let mut deferred_inputs = Vec::new();
19081908
let mut deferred_search_roots = Vec::new();
1909-
let mut extension_filter_present = false;
19101909
let mut positionals = Vec::new();
19111910
let mut positional_only = false;
19121911
let mut index = 1usize;
@@ -1942,7 +1941,6 @@ fn analyze_fd(
19421941
continue;
19431942
}
19441943
if token == "--extension" {
1945-
extension_filter_present = true;
19461944
index += 2;
19471945
continue;
19481946
}
@@ -1962,7 +1960,6 @@ fn analyze_fd(
19621960
continue;
19631961
}
19641962
if token.starts_with("--extension=") {
1965-
extension_filter_present = true;
19661963
index += 1;
19671964
continue;
19681965
}
@@ -2034,11 +2031,8 @@ fn analyze_fd(
20342031
index += 2;
20352032
continue;
20362033
}
2037-
FdShortOption::ExtensionInline => {
2038-
extension_filter_present = true;
2039-
}
2034+
FdShortOption::ExtensionInline => {}
20402035
FdShortOption::ExtensionNext => {
2041-
extension_filter_present = true;
20422036
index += 2;
20432037
continue;
20442038
}
@@ -2068,9 +2062,6 @@ fn analyze_fd(
20682062

20692063
match positionals.len() {
20702064
0 => {}
2071-
1 if extension_filter_present && deferred_search_roots.is_empty() => {
2072-
deferred_search_roots.push(positionals.remove(0));
2073-
}
20742065
1 => {}
20752066
_ => {
20762067
for token in positionals.into_iter().skip(1) {
@@ -3957,10 +3948,24 @@ mod tests {
39573948
analysis_without_explicit_pattern.adapter_ids,
39583949
vec![CommandAdapterId::Fd]
39593950
);
3960-
assert_path_inputs(
3961-
&analysis_without_explicit_pattern,
3962-
&[cwd.path().join("src")],
3951+
assert!(analysis_without_explicit_pattern.inputs.is_empty());
3952+
3953+
let analysis_with_catch_all_pattern = analyze_argv(
3954+
&[
3955+
OsString::from("fd"),
3956+
OsString::from("-e"),
3957+
OsString::from("rs"),
3958+
OsString::from("."),
3959+
OsString::from("src"),
3960+
],
3961+
cwd.path(),
3962+
)
3963+
.expect("analyze");
3964+
assert_eq!(
3965+
analysis_with_catch_all_pattern.adapter_ids,
3966+
vec![CommandAdapterId::Fd]
39633967
);
3968+
assert_path_inputs(&analysis_with_catch_all_pattern, &[cwd.path().join("src")]);
39643969

39653970
let analysis_with_single_positional_pattern =
39663971
analyze_argv(&[OsString::from("fd"), OsString::from("src")], cwd.path())

0 commit comments

Comments
 (0)