Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

choose_merge_request does not list all MRs #410

Open
3 tasks done
jakubbortlik opened this issue Oct 29, 2024 · 4 comments
Open
3 tasks done

choose_merge_request does not list all MRs #410

jakubbortlik opened this issue Oct 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jakubbortlik
Copy link
Collaborator

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

Use this minimal config:

-- This is a minimal init.lua that is used for debugging
local root = vim.fn.stdpath("run") .. "/nvim/mininit"
vim.fn.mkdir(root, "p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "harrisoncramer/gitlab.nvim",
    dependencies = {
      "MunifTanjim/nui.nvim",
      "nvim-lua/plenary.nvim",
      "sindrets/diffview.nvim",
      "stevearc/dressing.nvim",   -- Recommended but not required. Better UI for pickers.
      "nvim-tree/nvim-web-devicons" -- Recommended but not required. Icons in discussion tree.
    },
    enabled = true,
    build = function() require("gitlab.server").build(true) end, -- Builds the Go binary
    config = function()
      require("gitlab").setup()
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

Bug Description

In a project with more than 150 merge requests, when I run a command like this: :lua require("gitlab").choose_merge_request({state="all"}), I can only choose between 20 merge requests. The same happens with I try to limit the MRs to state="merged" or state="closed" - I can always only see at most 20 MRs, even if I can verify on Gitlab in the browser, that there are more of them in the respective category. This makes it impossible to select some of the closed/merged MRs.

Reproduction Steps

  1. Check out the feature branch
  2. Open Neovim with the minimal init from above.
  3. Run :lua require("gitlab").choose_merge_request({state="merged"})
@jakubbortlik jakubbortlik added the bug Something isn't working label Oct 29, 2024
@harrisoncramer
Copy link
Owner

The limit in Gitlab's APIs are 20 by default when listing merge requests (see the per_page parameter here: https://docs.gitlab.com/ee/api/merge_requests.html). We could adjust that limit, but it probably makes more sense to implement pagination to run through all the results and build a response that includes everything

Similar issue to this one, which I know has been blocked by a lack of movement on the go-gitlab side of things: #182

@jakubbortlik
Copy link
Collaborator Author

There's actually been some update in the linked issue, so possibly this will be solvable with pagination in not too long a time.

@aravind2612krishna
Copy link

one possible fix for this is to try and add an option where we see MRs where current user is reviewer.

@aravind2612krishna
Copy link

Oh, I think it is already there : gitlab.choose_merge_request_by_username - so never mind!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants