[go: up one dir, main page]

refactor(ci status): handle global repo flag explicitly

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

https://gitlab.com/gitlab-org/cli/-/blob/4170977c848880085099f1516d84ace0e6510fcb/commands/cmdutils/repo_override.go#L12

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 -R is set: no error, repo is -R, no explicit branch (default)
  • repo, but -R is 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

Merge request reports

Loading