Skip to content

Fixing problems with project overview

What does this MR do and why?

This fixes a few bugs on the project overview when the redirect_with_ref_type feature flag is enabled.

Fix problems around commit messages and last commits:

  • There is a graphql query with ref_type with the incorrect case (should be uppercase), this didn't seem to be related to the bugs here but we're fixing it anyways.
  • Make ref_type case insensitive for api requests (allowing frontend to always uppercase ref_type)
  • make project overview implicitly request a branch ref_type

Fix problems around buttons for adding files:

  • make head_tree always refer to a branch (the default branch) rather than situationally to a tag

Screenshots or screen recordings

Pay particular attention to:

  • the last commit widget is showing the wrong commit in the before image
  • the commit messages do not render for the files that are not in the tag in the before image
  • there is a README button on the before image even though there isn't a README in the default branch
Before After
before_fixing_ after_fixing

How to set up and validate locally

  1. Enable the redirect_with_ref_type feature flag (e.g Feature.enable(:redirect_with_ref_type))
  2. Create a repository with a README
  3. Create a branch main2 that does not have a readme For example
git checkout -b main2 &&
git rm README.md &&
git commit -m "removed readme"
  1. Add another file to main2
echo "newfile" > newfile &&
git add newfile &&
git commit -m "Add newfile" &&
git push origin main2
  1. Create a tag main2 that does have README For example
git checkout main &&
git tag main2 &&
git push --tags
  1. Make main2 the default branch of the repository (Settings -> Repository -> Branch defaults)
  2. Check the project overview to see that
    • the latest commit widget shows the message "removed readme"
    • the commit message next newfile loads
    • There is an Add README button

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 #419973 (closed)

Edited by Jerry Seto

Merge request reports

Loading