From 2aee35d0591f80b4a186e0ad3c600cd05c3f2a4d Mon Sep 17 00:00:00 2001 From: hungpt-a8e <49029378+hungpt-a8e@users.noreply.github.com> Date: Tue, 21 Oct 2025 14:20:27 +0700 Subject: [PATCH] feat(picker.git): allow passing extra args to git log command for file renames (#1964) ## Description Allows passing extra Git arguments (like `--git-dir` or `--work-tree`) to the rename detection logic inside `M.log` in `picker/source/git.lua`. Previously, these extra arguments from `opts.args` were applied to the main `git log` command but ignored during rename detection. This caused errors or incorrect results when working in non-standard repo setups. This change uses `git_args(...)` to build the rename detection command, ensuring consistent argument handling throughout `M.log`. --- lua/snacks/picker/source/git.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/snacks/picker/source/git.lua b/lua/snacks/picker/source/git.lua index 607f3286..8de2b849 100644 --- a/lua/snacks/picker/source/git.lua +++ b/lua/snacks/picker/source/git.lua @@ -137,7 +137,17 @@ function M.log(opts, ctx) Proc.proc({ cmd = "git", cwd = cwd, - args = { "log", "-z", "--follow", "--name-status", "--pretty=format:''", "--diff-filter=R", "--", file }, + args = git_args( + opts.args, + "log", + "-z", + "--follow", + "--name-status", + "--pretty=format:''", + "--diff-filter=R", + "--", + file + ), }, ctx)(function(item) for _, text in ipairs(vim.split(item.text, "\0")) do if text:find("^R%d%d%d$") then