Coverage statistics chart title incorrect and does not consider actual branch

Summary

The "Code coverage statistics" in Repository Analytics frontend always show "for master". Even if master is not the default branch or if the master branch does not exist at all.

Steps to reproduce

Go to a project where "master" is not the default branch and access the -/graphs/<non-master branch>/charts route.

The tagline shows "for master".

Example Project

If really needed, I could create one.

What is the current bug behavior?

"For master" is displayed.

What is the expected correct behavior?

"For " should be displayed. The view seems to be branch-specific so this branch name should be shown.

Relevant logs and/or screenshots

An new project with a single commit and a branch that is not "master" suffices.

Results of GitLab environment info

Version 13.6.1

Possible fixes

https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/projects/graphs/charts.html.haml#L25 is where this is caused

There are two options:

  • getting the default branch name from a variable and replace master with it
  • replace "master" with "default branch" so that it is correct and does not insert the actual name

I would be happy to create the MR myself, if this wanted and I could get a bit of guidance (haven't contributed to GitLab before).

Edited by Andreas Schmidt