Skip to content

Commit 1339685

Browse files
committed
Implement fetch popup
1 parent a61cea7 commit 1339685

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

lua/neogit/popups/fetch.lua

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,35 @@ end
2121

2222
function M.create()
2323
local p = popup
24-
.builder()
25-
:name("NeogitFetchPopup")
26-
:switch("p", "prune", "Prune deleted branches", false)
27-
:switch("t", "tags", "Fetch all tags", false)
28-
:action("p", "Fetch from pushremote", function(popup)
29-
fetch_from("pushremote", "origin", status.repo.head.branch, popup:get_arguments())
30-
end)
31-
:action("u", "Fetch from upstream", function(popup)
32-
local upstream = git.branch.get_upstream()
33-
if not upstream then
34-
return
35-
end
36-
37-
fetch_from(upstream.remote, upstream.remote, "", popup:get_arguments())
38-
end)
39-
:action("a", "Fetch from all remotes", function(popup)
40-
local args = popup:get_arguments()
41-
table.insert(args, "--all")
42-
43-
fetch_from("all remotes", "", "", args)
44-
end)
45-
:action("e", "Fetch from elsewhere", function(popup)
46-
local remote = input.get_user_input("remote: ")
47-
local branch = git.branch.prompt_for_branch()
48-
fetch_from(remote .. " " .. branch, remote, branch, popup:get_arguments())
49-
end)
50-
:build()
24+
.builder()
25+
:name("NeogitFetchPopup")
26+
:switch("p", "prune", "Prune deleted branches", false)
27+
:switch("t", "tags", "Fetch all tags", false)
28+
:action("p", "Fetch from pushremote", function(popup)
29+
30+
fetch_from("pushremote", "origin", status.repo.head.branch, popup:get_arguments())
31+
end)
32+
:action("u", "Fetch from upstream", function(popup)
33+
34+
local upstream = git.branch.get_upstream()
35+
if not upstream then
36+
return
37+
end
38+
39+
fetch_from(upstream.remote, upstream.remote, "", popup:get_arguments())
40+
end)
41+
:action("a", "Fetch from all remotes", function(popup)
42+
local args = popup:get_arguments()
43+
table.insert(args, "--all")
44+
45+
fetch_from("all remotes", "", "", args)
46+
end)
47+
:action("e", "Fetch from elsewhere", function(popup)
48+
local remote = input.get_user_input("remote: ")
49+
local branch = git.branch.prompt_for_branch()
50+
fetch_from(remote .. ' ' .. branch, remote, branch, popup:get_arguments())
51+
end)
52+
:build()
5153

5254
p:show()
5355

0 commit comments

Comments
 (0)