From 5cad31db07a06c83f8ab1067290edf6b27853353 Mon Sep 17 00:00:00 2001 From: takuto Date: Mon, 29 Dec 2025 18:41:23 +0900 Subject: [PATCH] feat(config): add option `allow_access_to_git_ignored_files` (#2882) --- lua/avante/config.lua | 1 + lua/avante/llm_tools/helpers.lua | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/avante/config.lua b/lua/avante/config.lua index 9762ad8..0bdb463 100644 --- a/lua/avante/config.lua +++ b/lua/avante/config.lua @@ -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: ' line is added to git commit message auto_add_current_file = true, -- Whether to automatically add the current file when opening a new chat diff --git a/lua/avante/llm_tools/helpers.lua b/lua/avante/llm_tools/helpers.lua index 501ba43..00ef327 100644 --- a/lua/avante/llm_tools/helpers.lua +++ b/lua/avante/llm_tools/helpers.lua @@ -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