mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-21 00:30:00 +02:00
Add option to disable warning when amending last commit
This commit is contained in:
committed by
Stefan Haller
parent
aa331e52b8
commit
708b30ab8a
@ -72,6 +72,9 @@ gui:
|
||||
# When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
|
||||
mouseEvents: true
|
||||
|
||||
# If true, do not show a warning when amending a commit.
|
||||
skipAmendWarning: false
|
||||
|
||||
# If true, do not show a warning when discarding changes in the staging view.
|
||||
skipDiscardChangeWarning: false
|
||||
|
||||
|
@ -384,6 +384,9 @@ gui:
|
||||
# When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
|
||||
mouseEvents: true
|
||||
|
||||
# If true, do not show a warning when amending a commit.
|
||||
skipAmendWarning: false
|
||||
|
||||
# If true, do not show a warning when discarding changes in the staging view.
|
||||
skipDiscardChangeWarning: false
|
||||
|
||||
|
@ -74,6 +74,8 @@ type GuiConfig struct {
|
||||
// If true, capture mouse events.
|
||||
// When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
|
||||
MouseEvents bool `yaml:"mouseEvents"`
|
||||
// If true, do not show a warning when amending a commit.
|
||||
SkipAmendWarning bool `yaml:"skipAmendWarning"`
|
||||
// If true, do not show a warning when discarding changes in the staging view.
|
||||
SkipDiscardChangeWarning bool `yaml:"skipDiscardChangeWarning"`
|
||||
// If true, do not show warning when applying/popping the stash
|
||||
@ -734,6 +736,7 @@ func GetDefaultConfig() *UserConfig {
|
||||
ScrollOffBehavior: "margin",
|
||||
TabWidth: 4,
|
||||
MouseEvents: true,
|
||||
SkipAmendWarning: false,
|
||||
SkipDiscardChangeWarning: false,
|
||||
SkipStashWarning: false,
|
||||
SidePanelWidth: 0.3333,
|
||||
|
@ -795,7 +795,7 @@ func (self *FilesController) handleAmendCommitPress() error {
|
||||
},
|
||||
},
|
||||
})
|
||||
} else {
|
||||
} else if !self.c.UserConfig().Gui.SkipAmendWarning {
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: self.c.Tr.AmendLastCommitTitle,
|
||||
Prompt: self.c.Tr.SureToAmend,
|
||||
@ -803,9 +803,11 @@ func (self *FilesController) handleAmendCommitPress() error {
|
||||
return doAmend()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return doAmend()
|
||||
}
|
||||
|
||||
func (self *FilesController) isResolvingConflicts() bool {
|
||||
|
@ -717,27 +717,19 @@ func (self *LocalCommitsController) moveUp(selectedCommits []*models.Commit, sta
|
||||
}
|
||||
|
||||
func (self *LocalCommitsController) amendTo(commit *models.Commit) error {
|
||||
var handleCommit func() error
|
||||
|
||||
if self.isSelectedHeadCommit() {
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: self.c.Tr.AmendCommitTitle,
|
||||
Prompt: self.c.Tr.AmendCommitPrompt,
|
||||
HandleConfirm: func() error {
|
||||
handleCommit = func() error {
|
||||
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
||||
if err := self.c.Helpers().AmendHelper.AmendHead(); err != nil {
|
||||
return err
|
||||
}
|
||||
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: self.c.Tr.AmendCommitTitle,
|
||||
Prompt: self.c.Tr.AmendCommitPrompt,
|
||||
HandleConfirm: func() error {
|
||||
} else {
|
||||
handleCommit = func() error {
|
||||
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
||||
return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func(gocui.Task) error {
|
||||
self.c.LogAction(self.c.Tr.Actions.AmendCommit)
|
||||
@ -745,7 +737,17 @@ func (self *LocalCommitsController) amendTo(commit *models.Commit) error {
|
||||
return self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
if self.c.UserConfig().Gui.SkipAmendWarning {
|
||||
return handleCommit()
|
||||
}
|
||||
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: self.c.Tr.AmendCommitTitle,
|
||||
Prompt: self.c.Tr.AmendCommitPrompt,
|
||||
HandleConfirm: handleCommit,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
@ -468,6 +468,11 @@
|
||||
"description": "If true, capture mouse events.\nWhen mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.",
|
||||
"default": true
|
||||
},
|
||||
"skipAmendWarning": {
|
||||
"type": "boolean",
|
||||
"description": "If true, do not show a warning when amending a commit.",
|
||||
"default": false
|
||||
},
|
||||
"skipDiscardChangeWarning": {
|
||||
"type": "boolean",
|
||||
"description": "If true, do not show a warning when discarding changes in the staging view.",
|
||||
|
Reference in New Issue
Block a user