Skip to content

Manual :Gitsigns attach does not work if attach_to_untracked = false #1026

@przepompownia

Description

@przepompownia

Description

For reporting previous issues I tested Gitsigns without attach_to_untracked (false by default since some moment) and found that I cannot manually attach new untracked file.

Neovim version

v0.11.0-dev-124+g90a4b1a59

Operating system and version

Debian Sid

Expected behavior

:Gitsigns attach works independently of attach_to_untracked.

Actual behavior

:Gitsigns attach seems to not work.

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

Inside some Git repo

  1. nvim --clean -u minimal.lua new3
  2. Gitsigns attach
  3. :Gistigns stage_buffer
  4. quit or suspend nvim
  5. GIT_PAGER= git diff --staged -- new3

Gitsigns debug messages

attach(1): Attaching (trigger=BufNewFile)
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 config user.name
run_job: git --version
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir .../.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol .../new3
attach(1): Not a file
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
cli.run: Running action 'attach' with arguments { "%" }
attach(%): Attaching
cli.run: Running action 'attach' with arguments { 1 }
attach(1): Attaching
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 config user.name
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --no-optional-locks --literal-pathspecs -c gc.auto=0 --git-dir .../.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol .../new3

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