Skip to content

Cannot choose merge requests if there are multiple merge requests with the same source branches #388

@mars90226

Description

@mars90226

Prerequsities

  • I'm on the latest version of the plugin
  • I've installed the required dependencies
  • I've run :h gitlab.nvim.troubleshooting and followed the steps there

Setup Configuration and Environment

{
    debug = { go_request = false, go_response = false },
    popup = {
      exit = "gq",
      backup_register = "+", -- NOTE: Default backup to system register, may hinder performance in WSL
    }
  }

Bug Description

Cannot choose merge requests if there are multiple merge requests with the same source branches.

When executing :lua require('gitlab').review, gitlab.nvim will show the following error:

gitlab.nvim: Multiple MRs found: please call gitlab.choose_merge_request()

And executing :lua require('gitlab').choose_merge_request() and choose the MR, it still show the above error.

It occurs when the source branch of a merge request is deleted upon merging, and another MR is created with a newly created source branch that has the same name as the original.

I think the solution to this is to check if the merge request is merged or not and only check if the open merge requests is more than one in

if len(mergeRequests) > 1 {

Reproduction Steps

  1. Create a MR with branch example.
  2. Merge with the option "delete source branch" checked.
  3. Create another MR with branch example.
  4. Checkout example branch.
  5. Open Neovim
  6. Execute :lua require('gitlab').review() or :lua require('gitlab').choose_merge_request() and select example branch.

Screenshots

圖片

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions