Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Jun 19, 2024
1 parent 4f71d16 commit 4d120b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lua/fzfx/cfg/git_branches.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,21 @@ M.fzf_opts = {
end,
}

-- This is actually for the "git checkout" actions.
--- @alias fzfx.GitBranchesPipelineContext {remotes:string[]|nil}
--- @return fzfx.GitBranchesPipelineContext
M._context_maker = function()
local ctx = {}
local git_remotes_cmd = cmds.GitRemotesCommand:run()
if git_remotes_cmd:failed() then
return ctx
end
ctx.remotes = git_remotes_cmd:output()
return ctx
end

M.other_opts = {
context_maker = M._context_maker,
}

return M
5 changes: 5 additions & 0 deletions spec/cfg/git_branches_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,10 @@ describe("fzfx.cfg.git_branches", function()
assert_true(str.find(actual, "git log --pretty") == 1)
end
end)
it("_context_maker", function()
local actual = git_branches_cfg._context_maker()
assert_eq(type(actual), "table")
assert_eq(type(actual.remotes), "table")
end)
end)
end)

0 comments on commit 4d120b1

Please sign in to comment.