feat: add git_stash picker (#800)
This commit is contained in:
committed by
GitHub
parent
c061c216bf
commit
9fd242db26
@@ -340,6 +340,23 @@ actions.git_create_branch = function(prompt_bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
--- Applies an existing git stash
|
||||
---@param prompt_bufnr number: The prompt bufnr
|
||||
actions.git_apply_stash = function(prompt_bufnr)
|
||||
local selection = action_state.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
local _, ret, stderr = utils.get_os_command_output({ 'git', 'stash', 'apply', '--index', selection.value })
|
||||
if ret == 0 then
|
||||
print("applied: " .. selection.value)
|
||||
else
|
||||
print(string.format(
|
||||
'Error when applying: %s. Git returned: "%s"',
|
||||
selection.value,
|
||||
table.concat(stderr, ' ')
|
||||
))
|
||||
end
|
||||
end
|
||||
|
||||
--- Checkout an existing git branch
|
||||
---@param prompt_bufnr number: The prompt bufnr
|
||||
actions.git_checkout = function(prompt_bufnr)
|
||||
|
||||
Reference in New Issue
Block a user