feat(git): support detached working trees (#2597)

* feat(git): support detached working trees

closes #2595

* [docgen] Update doc/telescope.txt
skip-checks: true

* fix: use_file_path

---------

Co-authored-by: Github Actions <actions@github>
This commit is contained in:
James Trew
2023-07-14 13:12:03 -04:00
committed by GitHub
parent 276362a802
commit 2ea8dcd17b
5 changed files with 124 additions and 38 deletions

View File

@@ -517,4 +517,22 @@ utils.__warn_no_selection = function(name)
})
end
--- Generate git command optionally with git env variables
---@param args string[]
---@param opts? table
---@return string[]
utils.__git_command = function(args, opts)
opts = opts or {}
local _args = { "git" }
if opts.gitdir then
vim.list_extend(_args, { "--git-dir", opts.gitdir })
end
if opts.toplevel then
vim.list_extend(_args, { "--work-tree", opts.toplevel })
end
return vim.list_extend(_args, args)
end
return utils