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.
|
# 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
|
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.
|
# If true, do not show a warning when discarding changes in the staging view.
|
||||||
skipDiscardChangeWarning: false
|
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.
|
# 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
|
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.
|
# If true, do not show a warning when discarding changes in the staging view.
|
||||||
skipDiscardChangeWarning: false
|
skipDiscardChangeWarning: false
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@ type GuiConfig struct {
|
|||||||
// If true, capture mouse events.
|
// 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.
|
// 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"`
|
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.
|
// If true, do not show a warning when discarding changes in the staging view.
|
||||||
SkipDiscardChangeWarning bool `yaml:"skipDiscardChangeWarning"`
|
SkipDiscardChangeWarning bool `yaml:"skipDiscardChangeWarning"`
|
||||||
// If true, do not show warning when applying/popping the stash
|
// If true, do not show warning when applying/popping the stash
|
||||||
@ -734,6 +736,7 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
ScrollOffBehavior: "margin",
|
ScrollOffBehavior: "margin",
|
||||||
TabWidth: 4,
|
TabWidth: 4,
|
||||||
MouseEvents: true,
|
MouseEvents: true,
|
||||||
|
SkipAmendWarning: false,
|
||||||
SkipDiscardChangeWarning: false,
|
SkipDiscardChangeWarning: false,
|
||||||
SkipStashWarning: false,
|
SkipStashWarning: false,
|
||||||
SidePanelWidth: 0.3333,
|
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{
|
self.c.Confirm(types.ConfirmOpts{
|
||||||
Title: self.c.Tr.AmendLastCommitTitle,
|
Title: self.c.Tr.AmendLastCommitTitle,
|
||||||
Prompt: self.c.Tr.SureToAmend,
|
Prompt: self.c.Tr.SureToAmend,
|
||||||
@ -803,9 +803,11 @@ func (self *FilesController) handleAmendCommitPress() error {
|
|||||||
return doAmend()
|
return doAmend()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return doAmend()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *FilesController) isResolvingConflicts() bool {
|
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 {
|
func (self *LocalCommitsController) amendTo(commit *models.Commit) error {
|
||||||
|
var handleCommit func() error
|
||||||
|
|
||||||
if self.isSelectedHeadCommit() {
|
if self.isSelectedHeadCommit() {
|
||||||
self.c.Confirm(types.ConfirmOpts{
|
handleCommit = func() error {
|
||||||
Title: self.c.Tr.AmendCommitTitle,
|
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
||||||
Prompt: self.c.Tr.AmendCommitPrompt,
|
if err := self.c.Helpers().AmendHelper.AmendHead(); err != nil {
|
||||||
HandleConfirm: func() error {
|
return err
|
||||||
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
}
|
||||||
if err := self.c.Helpers().AmendHelper.AmendHead(); err != nil {
|
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
||||||
return err
|
})
|
||||||
}
|
}
|
||||||
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC})
|
} else {
|
||||||
})
|
handleCommit = func() error {
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
self.c.Confirm(types.ConfirmOpts{
|
|
||||||
Title: self.c.Tr.AmendCommitTitle,
|
|
||||||
Prompt: self.c.Tr.AmendCommitPrompt,
|
|
||||||
HandleConfirm: func() error {
|
|
||||||
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
||||||
return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func(gocui.Task) error {
|
return self.c.WithWaitingStatus(self.c.Tr.AmendingStatus, func(gocui.Task) error {
|
||||||
self.c.LogAction(self.c.Tr.Actions.AmendCommit)
|
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)
|
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
|
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.",
|
"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
|
"default": true
|
||||||
},
|
},
|
||||||
|
"skipAmendWarning": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "If true, do not show a warning when amending a commit.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"skipDiscardChangeWarning": {
|
"skipDiscardChangeWarning": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "If true, do not show a warning when discarding changes in the staging view.",
|
"description": "If true, do not show a warning when discarding changes in the staging view.",
|
||||||
|
Reference in New Issue
Block a user