summaryrefslogtreecommitdiffstats
path: root/pkg/gui/commit_message_panel.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-04-13 13:34:12 +1000
committerJesse Duffield <jessedduffield@gmail.com>2019-04-13 14:38:17 +1000
commitab9fa291a8be2426463a25a545f08816dbc838b0 (patch)
tree80c30114cce8a876a9e00cd1a0e6943dd882bf30 /pkg/gui/commit_message_panel.go
parentcadc74eeec0840f8259e68364a08bdf6fad2479c (diff)
Add skipHookPrefix to config
allows a user to specify a commit message prefix that will tell lazygit to skip the pre-commit hook. This defaults to WIP. Setting it to the empty string will disable the feature. So if my message goes 'WIP: do the thing' then the pre-commit hook will not run
Diffstat (limited to 'pkg/gui/commit_message_panel.go')
-rw-r--r--pkg/gui/commit_message_panel.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 0f7e4ffcc..62892f09b 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -30,7 +30,12 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error {
if message == "" {
return gui.createErrorPanel(g, gui.Tr.SLocalize("CommitWithoutMessageErr"))
}
- ok, err := gui.runSyncOrAsyncCommand(gui.GitCommand.Commit(message))
+ flags := ""
+ skipHookPrefix := gui.Config.GetUserConfig().GetString("git.skipHookPrefix")
+ if skipHookPrefix != "" && strings.HasPrefix(message, skipHookPrefix) {
+ flags = "--no-verify"
+ }
+ ok, err := gui.runSyncOrAsyncCommand(gui.GitCommand.Commit(message, flags))
if err != nil {
return err
}