Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lua/neogit/buffers/commit_editor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ function M:open()
mappings = {
n = {
["q"] = function(buffer)
buffer:close(true)
if written or input.get_confirmation("Commit message isn't saved. Abort?") then
buffer:close(true)
end
end,
},
},
Expand Down
32 changes: 10 additions & 22 deletions lua/neogit/popups/commit/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,18 @@ local notif = require("neogit.lib.notification")
local CommitSelectViewBuffer = require("neogit.buffers.commit_select_view")
local git = require("neogit.lib.git")
local a = require("plenary.async")
local client = require("neogit.client")

local function do_commit(popup, cmd)
a.util.scheduler()

local notification = notif.create("Committing...", vim.log.levels.INFO, 9999)

local client = require("neogit.client")
local envs = client.get_envs_git_editor()

local result = cmd.env(envs).args(unpack(popup:get_arguments())):in_pty(true).call(true):trim()

a.util.scheduler()
if notification then
notification:delete()
end

if result.code == 0 then
notif.create("Successfully committed!")
vim.api.nvim_exec_autocmds("User", { pattern = "NeogitCommitComplete", modeline = false })
end

a.util.scheduler()

require("neogit.status").refresh(true, "do_commit")
client.wrap(cmd.arg_list(popup:get_arguments()), {
autocmd = "NeogitCommitComplete",
refresh = "do_commit",
msg = {
setup = "Committing...",
success = "Committed!",
fail = "Couldn't commit"
}
})
end

local function commit_special(popup, method)
Expand Down