about summary refs log tree commit diff
path: root/src/build_helper
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-03-16 13:26:30 +0100
committerJakub Beránek <berykubik@gmail.com>2025-03-19 14:55:52 +0100
commit2139a783b0c08f6d2718d88112bc50988006daab (patch)
tree9c78aaefdeffd8d09e4d61fc036aa646709518c2 /src/build_helper
parent599dc823c9d7049e8ee9eb80203a24cac41cb124 (diff)
downloadrust-2139a783b0c08f6d2718d88112bc50988006daab.tar.gz
rust-2139a783b0c08f6d2718d88112bc50988006daab.zip
Fix bug in `get_git_modified_files`
It was ignoring files without extension.
Diffstat (limited to 'src/build_helper')
-rw-r--r--src/build_helper/src/git.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs
index ea473c8c397..8d737450444 100644
--- a/src/build_helper/src/git.rs
+++ b/src/build_helper/src/git.rs
@@ -186,7 +186,10 @@ pub fn get_git_modified_files(
             let (status, name) = f.trim().split_once(char::is_whitespace).unwrap();
             if status == "D" {
                 None
-            } else if Path::new(name).extension().map_or(false, |ext| {
+            } else if Path::new(name).extension().map_or(extensions.is_empty(), |ext| {
+                // If there is no extension, we allow the path if `extensions` is empty
+                // If there is an extension, we allow it if `extension` is empty or it contains the
+                // extension.
                 extensions.is_empty() || extensions.contains(&ext.to_str().unwrap())
             }) {
                 Some(name.to_owned())