Skip to content

Commit 83e72fc

Browse files
committed
add fast commit
1 parent d2a2ae4 commit 83e72fc

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

lua/neogit/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ end
121121
---@class NeogitCommitEditorConfigPopup Popup window options
122122
---@field kind WindowKind The type of window that should be opened
123123
---@field show_staged_diff? boolean Display staged changes in a buffer when committing
124+
---@field fast? boolean Enter commit message in a non-interactive way (much faster in large repositories)
124125
---@field staged_diff_split_kind? StagedDiffSplitKind Whether to show staged changes in a vertical or horizontal split
125126
---@field spell_check? boolean Enable/Disable spell checking
126127

lua/neogit/popups/commit/actions.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ local function confirm_modifications()
3333
end
3434

3535
local function do_commit(popup, cmd)
36-
client.wrap(cmd.arg_list(popup:get_arguments()), {
36+
cmd.arg_list(popup:get_arguments())
37+
if config.values.commit_editor.fast then
38+
local message = vim.fn.input("Commit message: ")
39+
cmd.message(message)
40+
end
41+
client.wrap(cmd, {
3742
autocmd = "NeogitCommitComplete",
3843
msg = {
3944
success = "Committed",
4045
fail = "Commit failed",
4146
},
42-
interactive = true,
47+
interactive = not config.values.commit_editor.fast,
4348
show_diff = config.values.commit_editor.show_staged_diff,
4449
})
4550
end
@@ -105,9 +110,11 @@ local function commit_special(popup, method, opts)
105110
end
106111

107112
function M.commit(popup)
108-
if not git.status.anything_staged() and not allow_empty(popup) then
109-
notification.warn("No changes to commit.")
110-
return
113+
if not config.values.commit_editor.fast then
114+
if not git.status.anything_staged() and not allow_empty(popup) then
115+
notification.warn("No changes to commit.")
116+
return
117+
end
111118
end
112119

113120
do_commit(popup, git.cli.commit)

0 commit comments

Comments
 (0)