From e5f39646bfe3d446cc18c78e92b26465917f572d Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 3 Jul 2024 15:50:28 +0200 Subject: [PATCH] Some calls were made async that should not have been --- lua/neogit/integrations/diffview.lua | 4 ++-- lua/neogit/lib/git/branch.lua | 10 +++++----- lua/neogit/lib/git/cherry_pick.lua | 6 +++--- lua/neogit/lib/git/cli.lua | 1 + lua/neogit/lib/git/index.lua | 2 +- lua/neogit/lib/git/status.lua | 12 ++++++------ lua/neogit/popups/branch/actions.lua | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/lua/neogit/integrations/diffview.lua b/lua/neogit/integrations/diffview.lua index 517008f4d..643b08b2e 100644 --- a/lua/neogit/integrations/diffview.lua +++ b/lua/neogit/integrations/diffview.lua @@ -92,9 +92,9 @@ local function get_local_diff_view(section_name, item_name, opts) table.insert(args, "HEAD") end - return git.cli.show.file(unpack(args)).call({ trim = false }).stdout + return git.cli.show.file(unpack(args)).call({ async = false, trim = false }).stdout elseif kind == "working" then - local fdata = git.cli.show.file(path).call({ trim = false }).stdout + local fdata = git.cli.show.file(path).call({ async = false, trim = false }).stdout return side == "left" and fdata end end, diff --git a/lua/neogit/lib/git/branch.lua b/lua/neogit/lib/git/branch.lua index f96e822c1..178e771d6 100644 --- a/lua/neogit/lib/git/branch.lua +++ b/lua/neogit/lib/git/branch.lua @@ -54,7 +54,7 @@ function M.get_recent_local_branches() end function M.checkout(name, args) - git.cli.checkout.branch(name).arg_list(args or {}).call() + git.cli.checkout.branch(name).arg_list(args or {}).call { async = false } if config.values.fetch_after_checkout then local pushRemote = M.pushRemote_ref(name) @@ -78,7 +78,7 @@ function M.checkout(name, args) end function M.track(name, args) - git.cli.checkout.track(name).arg_list(args or {}).call() + git.cli.checkout.track(name).arg_list(args or {}).call { async = false } end function M.get_local_branches(include_current) @@ -139,7 +139,7 @@ end ---@param name string ---@param base_branch? string function M.create(name, base_branch) - git.cli.branch.args(name, base_branch).call() + git.cli.branch.args(name, base_branch).call { async = false } end function M.delete(name) @@ -149,10 +149,10 @@ function M.delete(name) if M.is_unmerged(name) then local message = ("'%s' contains unmerged commits! Are you sure you want to delete it?"):format(name) if input.get_permission(message) then - result = git.cli.branch.delete.force.name(name).call() + result = git.cli.branch.delete.force.name(name).call { async = false } end else - result = git.cli.branch.delete.name(name).call() + result = git.cli.branch.delete.name(name).call { async = false } end return result and result.code == 0 or false diff --git a/lua/neogit/lib/git/cherry_pick.lua b/lua/neogit/lib/git/cherry_pick.lua index 41323d940..65d2b4384 100644 --- a/lua/neogit/lib/git/cherry_pick.lua +++ b/lua/neogit/lib/git/cherry_pick.lua @@ -34,15 +34,15 @@ function M.apply(commits, args) end function M.continue() - git.cli["cherry-pick"].continue.call() + git.cli["cherry-pick"].continue.call { async = false } end function M.skip() - git.cli["cherry-pick"].skip.call() + git.cli["cherry-pick"].skip.call { async = false } end function M.abort() - git.cli["cherry-pick"].abort.call() + git.cli["cherry-pick"].abort.call { async = false } end return M diff --git a/lua/neogit/lib/git/cli.lua b/lua/neogit/lib/git/cli.lua index c4f0e2c36..c88cc9754 100644 --- a/lua/neogit/lib/git/cli.lua +++ b/lua/neogit/lib/git/cli.lua @@ -352,6 +352,7 @@ local configurations = { apply = config { flags = { + ignore_space_change = "--ignore-space-change", cached = "--cached", reverse = "--reverse", index = "--index", diff --git a/lua/neogit/lib/git/index.lua b/lua/neogit/lib/git/index.lua index e06399c3a..419e9e2be 100644 --- a/lua/neogit/lib/git/index.lua +++ b/lua/neogit/lib/git/index.lua @@ -100,7 +100,7 @@ function M.apply(patch, opts) cmd = cmd.index end - return cmd.with_patch(patch).call { async = false } + return cmd.ignore_space_change.with_patch(patch).call { async = false } end function M.add(files) diff --git a/lua/neogit/lib/git/status.lua b/lua/neogit/lib/git/status.lua index 27e1ae584..1f51ed83a 100644 --- a/lua/neogit/lib/git/status.lua +++ b/lua/neogit/lib/git/status.lua @@ -145,26 +145,26 @@ end ---@class NeogitGitStatus local status = { stage = function(files) - git.cli.add.files(unpack(files)).call() + git.cli.add.files(unpack(files)).call { async = false } end, stage_modified = function() - git.cli.add.update.call() + git.cli.add.update.call { async = false } end, stage_untracked = function() local paths = util.map(git.repo.state.untracked.items, function(item) return item.escaped_path end) - git.cli.add.files(unpack(paths)).call() + git.cli.add.files(unpack(paths)).call { async = false } end, stage_all = function() - git.cli.add.all.call() + git.cli.add.all.call { async = false } end, unstage = function(files) - git.cli.reset.files(unpack(files)).call() + git.cli.reset.files(unpack(files)).call { async = false } end, unstage_all = function() - git.cli.reset.call() + git.cli.reset.call { async = false } end, is_dirty = function() return #git.repo.state.staged.items > 0 or #git.repo.state.unstaged.items > 0 diff --git a/lua/neogit/popups/branch/actions.lua b/lua/neogit/popups/branch/actions.lua index e5d1506c6..82eecc70d 100644 --- a/lua/neogit/popups/branch/actions.lua +++ b/lua/neogit/popups/branch/actions.lua @@ -176,7 +176,7 @@ function M.rename_branch() return end - git.cli.branch.move.args(selected_branch, new_name).call() + git.cli.branch.move.args(selected_branch, new_name).call { async = false } notification.info(string.format("Renamed '%s' to '%s'", selected_branch, new_name)) fire_branch_event("NeogitBranchRename", { branch_name = selected_branch, new_name = new_name })