Skip to content

":Gitsigns setqflist all" does not work as intended #907

@rv-ragul

Description

@rv-ragul

Description

The documentation says
:Gitsigns {subcmd} {args} is equivalent to :lua require('gitsigns').{subcmd}({args}).

However, :lua require("gitsigns").setqflist("all") works but :Gitsigns setqflist all does not work. It returns the qflist for the current buffer.
And I found out the bug, In the file lua/gitsigns/actions.lua, exactly at line number 1234, args[2] is processed for the target parameter of gitsigns.setqflist(target). This is wrong. We have to check for args[1].

What I did...
when ":Gitsigns setqflist all" is run, args parameter in line 1233 will have the values as "{ 'all' }", there is no second value in args.

Now I changed args[2] to args[1] in line 1234, Now everything works fine.

We have to just alter only one line of code to fix the issue. I tried to make pull request but I dont know how to do it although I have git experience for 2 years

Neovim version

NVIM v0.10.0-dev-1318+gf5eabaa94 Build type: RelWithDebInfo LuaJIT 2.1.1696795921

Operating system and version

GNU/Linux Debian 12

Expected behavior

The args[1] should be used for target instead of args[2]

Actual behavior

:Gitsigns setqflist all only returns the qflist of current buffer

Minimal config

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
  -- ADD OTHER PLUGINS _NECESSARY_ TO REPRODUCE THE ISSUE
} do
  local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
  vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
  -- ADD GITSIGNS CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE
}

-- ADD INIT.LUA SETTINGS THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE

Steps to reproduce

  1. nvim --clean -u minimal.lua
  2. Go to git repo with changes in multiple files
  3. Run :Gitsigns setqflist all

Gitsigns debug messages

:Gitsigns debug_messages
cli.run: Running action 'setqflist' with arguments { "all" }

I added first two lines, As you can see, args has only one argument.

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