fix(git): use current dir when git not found to get a meaningful error message

This commit is contained in:
Folke Lemaitre
2024-06-29 15:37:26 +02:00
parent 501ff40768
commit b43ace1ecf

View File

@ -154,7 +154,7 @@ function M.blame_line(opts)
local cursor = vim.api.nvim_win_get_cursor(0)
local line = cursor[1]
local file = vim.api.nvim_buf_get_name(0)
local root = LazyVim.root.detectors.pattern(0, { ".git" })[1]
local root = LazyVim.root.detectors.pattern(0, { ".git" })[1] or "."
local cmd = { "git", "-C", root, "log", "-n", opts.count, "-u", "-L", line .. ",+1:" .. file }
return require("lazy.util").float_cmd(cmd, opts)
end