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

Hunks are not applied using .gitattribute filters #859

Closed
knpwrs opened this issue Aug 22, 2023 · 1 comment
Closed

Hunks are not applied using .gitattribute filters #859

knpwrs opened this issue Aug 22, 2023 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@knpwrs
Copy link

knpwrs commented Aug 22, 2023

Description

I was editing a file that I have encrypted with https://github.com/elasticdog/transcrypt. I staged the hunk that I edited using gitsigns.nvim, and then when I went to commit I got the following error from the transcrypt precommit hook:

Transcrypt managed file is not encrypted in the Git index: <edited file path redacted>

You probably staged this file using a tool that does not apply .gitattribute filters as required by Transcrypt.

Fix this by re-staging the file with a compatible tool or with Git on the command line:

    git rm --cached -- <edited file path redacted>
    git add <edited file path redacted>

Neovim version

v0.9.1

Operating system and version

macOS Ventura 13.4

Expected behavior

I should be able to stage hunks in files that use git attribute filters.

Actual behavior

Plain text is written directly to the git index? I'm not sure how exactly to debug further. Does gitsigns.nvim use the git cli directly?

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. Set up a repository with git attribute filters (git lfs, transcrypt, etc)
  2. Commit a file outside of nvim
  3. Attempt to stage a hunk from gitsigns.nvim
  4. Observe error from transcrypt precommit hook

Gitsigns debug messages

No response

@knpwrs knpwrs added the bug Something isn't working label Aug 22, 2023
@lewis6991
Copy link
Owner

Duplicate of #480

@lewis6991 lewis6991 marked this as a duplicate of #480 Aug 22, 2023
@lewis6991 lewis6991 added the duplicate This issue or pull request already exists label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants