Skip to content
Snippets Groups Projects

Update redirects and commit lookup code for controllers

All threads resolved!

What does this MR do and why?

Update redirect and commit lookup code for controllers

A ref is ambiguous if a ref_type is not specified and it could be interpreted as a tag or a branch. When the ref_type parameter is missing and the ref is ambiguous we should redirect with a ref_type parameter. git uses the tag when it exists so we redirect to the tag when tag and branch both exist.

This change includes a new class RequestedRef which is meant to encapsulate the logic for determining when a ref is ambiguous.

How to set up and validate locally

  1. Create a project that has a branch and a tag with the same name
  2. Browse the repository and switch to the branch via the dropdown and see that the existing behaviour is preserved (get redirected to the same view except for the commit id)
  3. Enable the redirect_with_ref_type feature flag
  4. Try selecting the branch again and see that there is a redirect to the same view with the ref_type in the query parameters of the url (the contents will be incorrect. displaying the correct contents will be handled in !122145 (merged))
  5. Try the same url without the ref_type and see that there is redirect to the same view with the ref_type but for tags

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #20526 (closed)

Edited by Jerry Seto

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Patrick Cyiza
  • Patrick Cyiza
  • Patrick Cyiza
  • Patrick Cyiza
  • Patrick Cyiza
  • Jerry Seto added 2 commits

    added 2 commits

    Compare with previous version

  • Ghost User
  • Ghost User
  • Jerry Seto added 1 commit

    added 1 commit

    Compare with previous version

  • Jerry Seto added 1 commit

    added 1 commit

    • c18eff9c - Update feature flag definition

    Compare with previous version

  • Patrick Cyiza approved this merge request

    approved this merge request

  • :wave: @jpcyiza, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.

    For more info, please refer to the following links:

  • Patrick Cyiza requested review from @mkaeppler

    requested review from @mkaeppler

  • Jerry Seto added 1415 commits

    added 1415 commits

    • c18eff9c...923cc8ac - 1408 commits from branch master
    • 94c80a71 - Update redirect and commit lookup code for controllers
    • 641a29e6 - Refactor controller tests
    • e53cec92 - Refactor RequestedRef
    • 027763d1 - Refactor tests more
    • 60beae12 - Update feature flag definition
    • 895432a0 - Compare results with literal SHAs instead of result of code
    • dbd24e8f - Refactor commit_without_ref_type

    Compare with previous version

  • Jerry Seto added 1 commit

    added 1 commit

    • 103d15b1 - Refactor spec to the sha being tested more clear

    Compare with previous version

  • Jerry Seto changed the description

    changed the description

  • JiHu failures look unrelated; some problem with setting up ActiveRecord? https://gitlab.com/gitlab-org-sandbox/gitlab-jh-validation/-/jobs/4537367742

  • Matthias Käppler approved this merge request

    approved this merge request

  • Matthias Käppler resolved all threads

    resolved all threads

  • Matthias Käppler enabled an automatic merge when the pipeline for 43df709c succeeds

    enabled an automatic merge when the pipeline for 43df709c succeeds

  • mentioned in commit e3021870

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading