Skip to content

Commit a20031f

Browse files
authored
Merge pull request #1411 from NeogitOrg/fix-async-calls
2 parents e1bcfc8 + e5f3964 commit a20031f

File tree

7 files changed

+19
-18
lines changed

7 files changed

+19
-18
lines changed

lua/neogit/integrations/diffview.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ local function get_local_diff_view(section_name, item_name, opts)
9292
table.insert(args, "HEAD")
9393
end
9494

95-
return git.cli.show.file(unpack(args)).call({ trim = false }).stdout
95+
return git.cli.show.file(unpack(args)).call({ async = false, trim = false }).stdout
9696
elseif kind == "working" then
97-
local fdata = git.cli.show.file(path).call({ trim = false }).stdout
97+
local fdata = git.cli.show.file(path).call({ async = false, trim = false }).stdout
9898
return side == "left" and fdata
9999
end
100100
end,

lua/neogit/lib/git/branch.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function M.get_recent_local_branches()
5454
end
5555

5656
function M.checkout(name, args)
57-
git.cli.checkout.branch(name).arg_list(args or {}).call()
57+
git.cli.checkout.branch(name).arg_list(args or {}).call { async = false }
5858

5959
if config.values.fetch_after_checkout then
6060
local pushRemote = M.pushRemote_ref(name)
@@ -78,7 +78,7 @@ function M.checkout(name, args)
7878
end
7979

8080
function M.track(name, args)
81-
git.cli.checkout.track(name).arg_list(args or {}).call()
81+
git.cli.checkout.track(name).arg_list(args or {}).call { async = false }
8282
end
8383

8484
function M.get_local_branches(include_current)
@@ -139,7 +139,7 @@ end
139139
---@param name string
140140
---@param base_branch? string
141141
function M.create(name, base_branch)
142-
git.cli.branch.args(name, base_branch).call()
142+
git.cli.branch.args(name, base_branch).call { async = false }
143143
end
144144

145145
function M.delete(name)
@@ -149,10 +149,10 @@ function M.delete(name)
149149
if M.is_unmerged(name) then
150150
local message = ("'%s' contains unmerged commits! Are you sure you want to delete it?"):format(name)
151151
if input.get_permission(message) then
152-
result = git.cli.branch.delete.force.name(name).call()
152+
result = git.cli.branch.delete.force.name(name).call { async = false }
153153
end
154154
else
155-
result = git.cli.branch.delete.name(name).call()
155+
result = git.cli.branch.delete.name(name).call { async = false }
156156
end
157157

158158
return result and result.code == 0 or false

lua/neogit/lib/git/cherry_pick.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ function M.apply(commits, args)
3434
end
3535

3636
function M.continue()
37-
git.cli["cherry-pick"].continue.call()
37+
git.cli["cherry-pick"].continue.call { async = false }
3838
end
3939

4040
function M.skip()
41-
git.cli["cherry-pick"].skip.call()
41+
git.cli["cherry-pick"].skip.call { async = false }
4242
end
4343

4444
function M.abort()
45-
git.cli["cherry-pick"].abort.call()
45+
git.cli["cherry-pick"].abort.call { async = false }
4646
end
4747

4848
return M

lua/neogit/lib/git/cli.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ local configurations = {
352352

353353
apply = config {
354354
flags = {
355+
ignore_space_change = "--ignore-space-change",
355356
cached = "--cached",
356357
reverse = "--reverse",
357358
index = "--index",

lua/neogit/lib/git/index.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function M.apply(patch, opts)
100100
cmd = cmd.index
101101
end
102102

103-
return cmd.with_patch(patch).call { async = false }
103+
return cmd.ignore_space_change.with_patch(patch).call { async = false }
104104
end
105105

106106
function M.add(files)

lua/neogit/lib/git/status.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,26 @@ end
145145
---@class NeogitGitStatus
146146
local status = {
147147
stage = function(files)
148-
git.cli.add.files(unpack(files)).call()
148+
git.cli.add.files(unpack(files)).call { async = false }
149149
end,
150150
stage_modified = function()
151-
git.cli.add.update.call()
151+
git.cli.add.update.call { async = false }
152152
end,
153153
stage_untracked = function()
154154
local paths = util.map(git.repo.state.untracked.items, function(item)
155155
return item.escaped_path
156156
end)
157157

158-
git.cli.add.files(unpack(paths)).call()
158+
git.cli.add.files(unpack(paths)).call { async = false }
159159
end,
160160
stage_all = function()
161-
git.cli.add.all.call()
161+
git.cli.add.all.call { async = false }
162162
end,
163163
unstage = function(files)
164-
git.cli.reset.files(unpack(files)).call()
164+
git.cli.reset.files(unpack(files)).call { async = false }
165165
end,
166166
unstage_all = function()
167-
git.cli.reset.call()
167+
git.cli.reset.call { async = false }
168168
end,
169169
is_dirty = function()
170170
return #git.repo.state.staged.items > 0 or #git.repo.state.unstaged.items > 0

lua/neogit/popups/branch/actions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function M.rename_branch()
176176
return
177177
end
178178

179-
git.cli.branch.move.args(selected_branch, new_name).call()
179+
git.cli.branch.move.args(selected_branch, new_name).call { async = false }
180180

181181
notification.info(string.format("Renamed '%s' to '%s'", selected_branch, new_name))
182182
fire_branch_event("NeogitBranchRename", { branch_name = selected_branch, new_name = new_name })

0 commit comments

Comments
 (0)