Preserve selected tree path when switching revisions in Commits view
What does this MR do and why?
Makes the Commits view preserve the selected tree path when switching refs using the picker.
It also changes that view's handling of non-existent paths to be consistent with blob
view: When the selected path does not exist on the selected ref, show a "$file did not exist on $ref"
message and go to the root.
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
Before | After | Note |
---|---|---|
Load the Commits view of a file. |
||
Select revision Before: showed commit history at the root of the tree. After: shows commit history of the file selected on the previous page. |
||
Before: showed commit history in tag After: Catches that the file does not exist in |
How to set up and validate locally
- Set up the GitLab Development Kit (GDK) locally (instructions here).
- Check out the changes from this branch into the GDK tree.
- Go to a file's Commits view: http://gdk.local:3000/gitlab-org/gitlab-test/-/commits/lock-detection/with%20space/README.md?ref_type=heads
- Switch to different revisions, including
v1.0.0
where the file does not exist.
Closes #444282.