fix(picker.git): default to git root for git_files. Closes #751

This commit is contained in:
Folke Lemaitre 2025-01-28 16:29:24 +01:00
parent c875fefa82
commit 3cdebee880
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -21,6 +21,10 @@ function M.files(opts, ctx)
elseif opts.submodules then
table.insert(args, "--recurse-submodules")
end
if not opts.cwd then
opts.cwd = Snacks.git.get_root()
ctx.picker:set_cwd(opts.cwd)
end
local cwd = vim.fs.normalize(opts and opts.cwd or uv.cwd() or ".") or nil
return require("snacks.picker.source.proc").proc({
opts,