mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
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
This commit is contained in:
parent
cadc74eeec
commit
ab9fa291a8
@ -21,6 +21,7 @@
|
|||||||
merging:
|
merging:
|
||||||
# only applicable to unix users
|
# only applicable to unix users
|
||||||
manualCommit: false
|
manualCommit: false
|
||||||
|
skipHookPrefix: WIP
|
||||||
update:
|
update:
|
||||||
method: prompt # can be: prompt | background | never
|
method: prompt # can be: prompt | background | never
|
||||||
days: 14 # how often an update is checked for
|
days: 14 # how often an update is checked for
|
||||||
|
@ -334,8 +334,8 @@ func (c *GitCommand) usingGpg() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Commit commits to git
|
// Commit commits to git
|
||||||
func (c *GitCommand) Commit(message string) (*exec.Cmd, error) {
|
func (c *GitCommand) Commit(message string, flags string) (*exec.Cmd, error) {
|
||||||
command := fmt.Sprintf("git commit -m %s", c.OSCommand.Quote(message))
|
command := fmt.Sprintf("git commit %s -m %s", flags, c.OSCommand.Quote(message))
|
||||||
if c.usingGpg() {
|
if c.usingGpg() {
|
||||||
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil
|
return c.OSCommand.PrepareSubProcess(c.OSCommand.Platform.shell, c.OSCommand.Platform.shellArg, command), nil
|
||||||
}
|
}
|
||||||
|
@ -248,6 +248,7 @@ func GetDefaultConfig() []byte {
|
|||||||
git:
|
git:
|
||||||
merging:
|
merging:
|
||||||
manualCommit: false
|
manualCommit: false
|
||||||
|
skipHookPrefix: 'WIP'
|
||||||
update:
|
update:
|
||||||
method: prompt # can be: prompt | background | never
|
method: prompt # can be: prompt | background | never
|
||||||
days: 14 # how often a update is checked for
|
days: 14 # how often a update is checked for
|
||||||
|
@ -30,7 +30,12 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error {
|
|||||||
if message == "" {
|
if message == "" {
|
||||||
return gui.createErrorPanel(g, gui.Tr.SLocalize("CommitWithoutMessageErr"))
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user