Skip to content

Commit 2139a78

Browse files
committed
Fix bug in get_git_modified_files
It was ignoring files without extension.
1 parent 599dc82 commit 2139a78

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/build_helper/src/git.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ pub fn get_git_modified_files(
186186
let (status, name) = f.trim().split_once(char::is_whitespace).unwrap();
187187
if status == "D" {
188188
None
189-
} else if Path::new(name).extension().map_or(false, |ext| {
189+
} else if Path::new(name).extension().map_or(extensions.is_empty(), |ext| {
190+
// If there is no extension, we allow the path if `extensions` is empty
191+
// If there is an extension, we allow it if `extension` is empty or it contains the
192+
// extension.
190193
extensions.is_empty() || extensions.contains(&ext.to_str().unwrap())
191194
}) {
192195
Some(name.to_owned())

0 commit comments

Comments
 (0)