feat(config): add option allow_access_to_git_ignored_files (#2882)

This commit is contained in:
takuto
2025-12-29 18:41:23 +09:00
committed by GitHub
parent 2ffe820ec1
commit 5cad31db07
2 changed files with 3 additions and 1 deletions

View File

@@ -546,6 +546,7 @@ M._defaults = {
---@type boolean | string[] -- true: auto-approve all tools, false: normal prompts, string[]: auto-approve specific tools by name
auto_approve_tool_permissions = true, -- Default: auto-approve all tools (no prompts)
auto_check_diagnostics = true,
allow_access_to_git_ignored_files = false,
enable_fastapply = false,
include_generated_by_commit_line = false, -- Controls if 'Generated-by: <provider/model>' line is added to git commit message
auto_add_current_file = true, -- Whether to automatically add the current file when opening a new chat

View File

@@ -150,8 +150,9 @@ function M.has_permission_to_access(abs_path)
local config_dir = vim.fn.stdpath("config")
local in_project = abs_path:sub(1, #project_root) == project_root
local in_config = abs_path:sub(1, #config_dir) == config_dir
local bypass_ignore = Config.behaviour and Config.behaviour.allow_access_to_git_ignored_files
if not in_project and not in_config then return false end
return not M.is_ignored(abs_path)
return bypass_ignore or not M.is_ignored(abs_path)
end
---@param path string