Fix path parameter bug in repository commits API
What does this MR do and why?
Fix path parameter bug in repository commits API
The GET /projects/:id/repository/commits API endpoint with the path parameter incorrectly returned all commits in the project when filtering by a file that had only been modified by one commit, instead of returning just that single commit.
The issue was caused by the 'follow' parameter being enabled for single-path requests. This parameter is intended to track file renames but had an unintended side effect where it caused all commits to be returned in certain edge cases.
This fix disables the 'follow' parameter when path filtering is active, ensuring that only commits that actually modified the specified file are returned.
Expected behavior:
- File modified by multiple commits: Returns only those commits
- File modified by one commit: Returns only that commit (was broken)
- Non-existent file: Returns no commits
Closes #559254
Changelog: fixed
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.