`glab ci status` fails for an MR branch, when `Merged Results Pipelines` are enabled

Description

When running glab ci status without an argument for a branch that has an open merge request, the command fails saying there are no pipelines for the current branch.

Expected Behavior vs Actual Behavior

As a user, I would expect glab ci status to check for any open merge requests for the current branch. It would appear that the ref names are incorrectly compared. For example I have a branch named XYZ-123 but the output of glab ci list shows this as refs/merge-requests/1234/merge, explicitly referring to the merge request pipeline, not the branch name.

Possible Fix

If there is no pipeline for the current branch name, try to find an open merge request for the branch and check that instead.

Steps to Reproduce

  1. Create a branch on a repo that is configured for merge request pipelines: git checkout -b my_branch
  2. Make a modification
  3. git add, git commit, and git push
  4. Open a new merge request for your branch against the upstream repo and wait for the merge request pipeline to start
  5. While still operating in the checked out branch in your terminal, run glab ci status which will fail
  6. Run glab ci list and take note of the different ref corresponding to the merge request number
  7. Run glab ci status -b REF_OF_MERGE_REQUEST and notice the correct output

Logs

See steps to reproduce

Your Environment

  • MacOS Monterey 12.1, AMD64
  • glab version 1.22.0 (2022-01-10)
  • git version 2.36.1
  • tmux 3.2
  • iterm2 3.4.15

Implementation plan

Similar fix required as in !1419 (merged)

Edited by Jay McCure