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

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

Closed
rv-ragul opened this issue Oct 13, 2023 · 0 comments · Fixed by #1002
Closed

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

rv-ragul opened this issue Oct 13, 2023 · 0 comments · Fixed by #1002
Labels
bug Something isn't working

Comments

@rv-ragul
Copy link

rv-ragul commented Oct 13, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment