mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(picker.git): git log file/line for a file not in cwd. Fixes #616
This commit is contained in:
parent
afcf4a9d95
commit
903431903b
1 changed files with 3 additions and 1 deletions
|
@ -62,8 +62,9 @@ function M.log(opts)
|
|||
args[#args + 1] = file
|
||||
end
|
||||
|
||||
local cwd = vim.fs.normalize(opts and opts.cwd or uv.cwd() or ".") or nil
|
||||
local cwd = vim.fs.normalize(file and vim.fn.fnamemodify(file, ":h") or opts and opts.cwd or uv.cwd() or ".") or nil
|
||||
return require("snacks.picker.source.proc").proc(vim.tbl_deep_extend("force", {
|
||||
cwd = cwd,
|
||||
cmd = "git",
|
||||
args = args,
|
||||
---@param item snacks.picker.finder.Item
|
||||
|
@ -93,6 +94,7 @@ function M.status(opts)
|
|||
local cwd = vim.fs.normalize(opts and opts.cwd or uv.cwd() or ".") or nil
|
||||
cwd = Snacks.git.get_root(cwd)
|
||||
return require("snacks.picker.source.proc").proc(vim.tbl_deep_extend("force", {
|
||||
cwd = cwd,
|
||||
cmd = "git",
|
||||
args = args,
|
||||
---@param item snacks.picker.finder.Item
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue