feat(picker.git): allow passing extra args to git log command for file renames (#1964)
Some checks are pending
CI / ci (push) Waiting to run

## 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`.
This commit is contained in:
hungpt-a8e 2025-10-21 14:20:27 +07:00 committed by GitHub
parent d31f50f0a7
commit 2aee35d059
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -137,7 +137,17 @@ function M.log(opts, ctx)
Proc.proc({ Proc.proc({
cmd = "git", cmd = "git",
cwd = cwd, 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) }, ctx)(function(item)
for _, text in ipairs(vim.split(item.text, "\0")) do for _, text in ipairs(vim.split(item.text, "\0")) do
if text:find("^R%d%d%d$") then if text:find("^R%d%d%d$") then