refactor(ci status): handle global repo flag explicitly
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
Description
- refactor(ci status): handle global repo flag explicitly
The handling of global repo flag was broken for ci status in
!1849 (merged)
while implementing repo lookup from tracked branch.
The reason why everybody missed the global flag break is that it is handled implicitly in this helper function
Even if that pathway was covered by tests, there is no way for an external contributor to know all the details and make changes, so my proposal is to simplify the code. Finally repo/branch detection logic can be moved into simple function to add tests without HTTP mocks.
Related Issues
Resolves #7780
How has this been tested?
Wrote tests for:
-
no repo: error -
no repo, but -Ris set: no error, repo is-R, no explicit branch (default)
-
repo, but -Ris set: no error, repo is-R, branch is local -
same, but branch is explicit: use branch
-
repo: use repo, current branch -
if branch param, use param -
if branch tracks remote, use remote repo/branch
Screenshots (if appropriate):
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation -
Chore (Related to CI or Packaging to platforms) -
Test gap
Edited by Anatoli Babenia