Link commit list browse button to the current file path
What does this MR do and why?
Fixes a regression in the redesigned commits list (project_commits_refactor): when viewing a file's history, the per-commit "Browse commit files" button linked to the repository root tree at that commit, dropping the file-path context the user was browsing in.
This passes the already-tracked currentPath from the commit list app down to the per-commit action buttons and overflow menu, which now link to /-/blob/<sha>/<path> when a path is set. Projects::BlobController#redirect_to_project_tree_path redirects blob URLs that point at a directory to the tree view, so one URL shape covers both files and directories — matching the pre-refactor link_to_browse_code helper behaviour and the documented behaviour. With no path (whole-repo commits list) the button still links to /-/tree/<sha>.
The button label is unchanged; renaming it (as floated in the issue) is a design question that can follow up separately.
References
- Resolves #633624 (closed)
- Regression introduced by !232210 (merged)
Screenshots or screen recordings
No visual change — only the link target of the existing buttons changes.
| Before | After |
|---|---|
Button links to /-/tree/<sha> even on a file's history |
Button links to /-/blob/<sha>/<path> on a file's history |
How to set up and validate locally
- Open a file in the repository browser and click History.
- On any commit row, click the folder (Browse commit files) button — it should open that file as it appeared at that commit.
- Repeat from a directory's history: the button should open the directory tree at that commit.
- From the whole repository's commits page, the button should still open the repository root tree at that commit.
- On a narrow viewport, verify the same via the per-commit overflow menu's Browse files at this commit item.
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.