Skip to content

Upstream: Gitsigns not respecting status.showUntrackedFiles #4

@hernancerm

Description

@hernancerm

On the branch items (to become version 0.2.0), the Git HEAD is retrieved using the Gitsigns provided buf-local var gitsigns_head. This introduces an issue which is a regression. The original problem is described here: #2 (comment)

Thanks for this. At first glance, this is now working as expected when I've got a file loaded that's managed as part of the detached worktree. However, there seems to be a negative side-effect of the logic since the git info is also displayed when running Neovim from a directory that is not part of the worktree. In other words, let's say we're in ~/projects/foobar which isn't even a git repo and run nvim baz.txt, I wouldn't expect to see the git bits. If I read the logic from above correctly, the file loaded in the buffer (hopefully the complete path) would need to be managed in the detached worktree in order to qualify. Maybe that test isn't in place?

Steps to reproduce

  1. Bare repo ~/path/to/some/bare-repo.git exists with status.showUntrackedFiles set to false.
  2. Gitsigns config with this worktree:
worktrees = {
  {
    toplevel = vim.env.HOME,
    gitdir = vim.env.HOME .. "/path/to/some/bare-repo.git"
  }
}
  1. Open a file not managed by the repo, e.g., in my machine that can be ~/dev/temp/_.lua.

Actual behavior

The Git HEAD is displayed by Bareline.

Expected behavior

The Git HEAD is not displayed by Bareline, since the bare repo has status.showUntrackedFiles set to false.

Notes

  • A text search in the Gitsigns repo shows no matches for showUntrackedFiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions