feat(config): add option allow_access_to_git_ignored_files (#2882)
This commit is contained in:
@@ -546,6 +546,7 @@ M._defaults = {
|
|||||||
---@type boolean | string[] -- true: auto-approve all tools, false: normal prompts, string[]: auto-approve specific tools by name
|
---@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_approve_tool_permissions = true, -- Default: auto-approve all tools (no prompts)
|
||||||
auto_check_diagnostics = true,
|
auto_check_diagnostics = true,
|
||||||
|
allow_access_to_git_ignored_files = false,
|
||||||
enable_fastapply = false,
|
enable_fastapply = false,
|
||||||
include_generated_by_commit_line = false, -- Controls if 'Generated-by: <provider/model>' line is added to git commit message
|
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
|
auto_add_current_file = true, -- Whether to automatically add the current file when opening a new chat
|
||||||
|
|||||||
@@ -150,8 +150,9 @@ function M.has_permission_to_access(abs_path)
|
|||||||
local config_dir = vim.fn.stdpath("config")
|
local config_dir = vim.fn.stdpath("config")
|
||||||
local in_project = abs_path:sub(1, #project_root) == project_root
|
local in_project = abs_path:sub(1, #project_root) == project_root
|
||||||
local in_config = abs_path:sub(1, #config_dir) == config_dir
|
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
|
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
|
end
|
||||||
|
|
||||||
---@param path string
|
---@param path string
|
||||||
|
|||||||
Reference in New Issue
Block a user