Fix gitattributes parser to apply patterns to subdirectories
What does this MR do and why?
Contributes to #513617 (closed)
Problem
Patterns like Dockerfile.* are currently applied only to the root
directory of the repository.
-
Dockerfile.local- match -
docker/Dockerfile.local- no match
However, it's incorrect. Git captures both file paths as matches. So GitLab should follow the same logic.
Solution
Use File::FNM_PATHNAME to support glob pattern matching.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After (FROM is highlighted) |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Enable feature flag
Feature.enable(:attribute_parser_fix) - Clone an example project (or recreate it locally): https://gitlab.com/iamthad/gitattributes-bug-repro
- Visit
https://<path_to_project_in_gdk>/-/blob/main/docker/Dockerfile.local?ref_type=heads - The code should be highlighted

