mirror of
https://github.com/zoriya/telescope.nvim.git
synced 2025-12-06 06:46:10 +00:00
Fallback use_file_path to vim.loop.cwd()
This commit is contained in:
@@ -454,7 +454,9 @@ local try_worktrees = function(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
error(opts.cwd .. " is not a git directory")
|
local cwd = opts.cwd
|
||||||
|
opts.cwd = nil
|
||||||
|
return cwd
|
||||||
end
|
end
|
||||||
|
|
||||||
local current_path_toplevel = function()
|
local current_path_toplevel = function()
|
||||||
@@ -474,7 +476,9 @@ local set_opts_cwd = function(opts)
|
|||||||
if not opts.cwd then
|
if not opts.cwd then
|
||||||
opts.cwd = vim.fn.expand "%:p:h"
|
opts.cwd = vim.fn.expand "%:p:h"
|
||||||
try_worktrees(opts)
|
try_worktrees(opts)
|
||||||
return
|
if not opts.cwd then
|
||||||
|
opts.cwd = vim.loop.cwd()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
opts.cwd = vim.loop.cwd()
|
opts.cwd = vim.loop.cwd()
|
||||||
@@ -487,7 +491,10 @@ local set_opts_cwd = function(opts)
|
|||||||
local in_bare = utils.get_os_command_output({ "git", "rev-parse", "--is-bare-repository" }, opts.cwd)
|
local in_bare = utils.get_os_command_output({ "git", "rev-parse", "--is-bare-repository" }, opts.cwd)
|
||||||
|
|
||||||
if in_worktree[1] ~= "true" and in_bare[1] ~= "true" then
|
if in_worktree[1] ~= "true" and in_bare[1] ~= "true" then
|
||||||
try_worktrees(opts)
|
local cwd = try_worktrees(opts)
|
||||||
|
if not opts.cwd then
|
||||||
|
error(cwd .. " is not a git directory")
|
||||||
|
end
|
||||||
elseif in_worktree[1] ~= "true" and in_bare[1] == "true" then
|
elseif in_worktree[1] ~= "true" and in_bare[1] == "true" then
|
||||||
opts.is_bare = true
|
opts.is_bare = true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user