mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(picker.git): added all
option to also list remote branched for git_branches
. Closes #1465
This commit is contained in:
parent
e591715b03
commit
3d695ab7d0
3 changed files with 15 additions and 3 deletions
|
@ -346,12 +346,16 @@ end
|
|||
function M.git_checkout(picker, item)
|
||||
picker:close()
|
||||
if item then
|
||||
local what = item.branch or item.commit
|
||||
local what = item.branch or item.commit --[[@as string?]]
|
||||
if not what then
|
||||
Snacks.notify.warn("No branch or commit found", { title = "Snacks Picker" })
|
||||
return
|
||||
end
|
||||
local cmd = { "git", "checkout", what }
|
||||
local remote_branch = what:match("^remotes/[^/]+/(.+)$")
|
||||
if remote_branch then
|
||||
cmd = { "git", "checkout", "-b", remote_branch, what }
|
||||
end
|
||||
if item.file then
|
||||
vim.list_extend(cmd, { "--", item.file })
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue