Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions lua/neogit/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ end
---@class NeogitCommitEditorConfigPopup Popup window options
---@field kind WindowKind The type of window that should be opened
---@field show_staged_diff? boolean Display staged changes in a buffer when committing
---@field fast? boolean Enter commit message in a non-interactive way (much faster in large repositories)
---@field staged_diff_split_kind? StagedDiffSplitKind Whether to show staged changes in a vertical or horizontal split
---@field spell_check? boolean Enable/Disable spell checking

Expand Down
17 changes: 12 additions & 5 deletions lua/neogit/popups/commit/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ local function confirm_modifications()
end

local function do_commit(popup, cmd)
client.wrap(cmd.arg_list(popup:get_arguments()), {
cmd.arg_list(popup:get_arguments())
Comment thread
benjiwolff marked this conversation as resolved.
Outdated
if config.values.commit_editor.fast then
local message = vim.fn.input("Commit message: ")
cmd.message(message)
end
client.wrap(cmd, {
autocmd = "NeogitCommitComplete",
msg = {
success = "Committed",
fail = "Commit failed",
},
interactive = true,
interactive = not config.values.commit_editor.fast,
show_diff = config.values.commit_editor.show_staged_diff,
})
end
Expand Down Expand Up @@ -105,9 +110,11 @@ local function commit_special(popup, method, opts)
end

function M.commit(popup)
if not git.status.anything_staged() and not allow_empty(popup) then
notification.warn("No changes to commit.")
return
if not config.values.commit_editor.fast then
Comment thread
benjiwolff marked this conversation as resolved.
Outdated
if not git.status.anything_staged() and not allow_empty(popup) then
notification.warn("No changes to commit.")
return
end
end

do_commit(popup, git.cli.commit)
Expand Down
Loading