mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-04 23:37:41 +02:00
show error when user attempts to commit when no files are present
This commit is contained in:
parent
74ce65d9ff
commit
b1cda65dcf
@ -380,6 +380,10 @@ func (gui *Gui) handleCommitPress() error {
|
|||||||
return gui.surfaceError(err)
|
return gui.surfaceError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if gui.State.FileManager.GetItemsLength() == 0 {
|
||||||
|
return gui.createErrorPanel(gui.Tr.NoFilesStagedTitle)
|
||||||
|
}
|
||||||
|
|
||||||
if len(gui.stagedFiles()) == 0 {
|
if len(gui.stagedFiles()) == 0 {
|
||||||
return gui.promptToStageAllAndRetry(gui.handleCommitPress)
|
return gui.promptToStageAllAndRetry(gui.handleCommitPress)
|
||||||
}
|
}
|
||||||
@ -428,6 +432,10 @@ func (gui *Gui) promptToStageAllAndRetry(retry func() error) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleAmendCommitPress() error {
|
func (gui *Gui) handleAmendCommitPress() error {
|
||||||
|
if gui.State.FileManager.GetItemsLength() == 0 {
|
||||||
|
return gui.createErrorPanel(gui.Tr.NoFilesStagedTitle)
|
||||||
|
}
|
||||||
|
|
||||||
if len(gui.stagedFiles()) == 0 {
|
if len(gui.stagedFiles()) == 0 {
|
||||||
return gui.promptToStageAllAndRetry(gui.handleAmendCommitPress)
|
return gui.promptToStageAllAndRetry(gui.handleAmendCommitPress)
|
||||||
}
|
}
|
||||||
@ -458,6 +466,10 @@ func (gui *Gui) handleAmendCommitPress() error {
|
|||||||
// handleCommitEditorPress - handle when the user wants to commit changes via
|
// handleCommitEditorPress - handle when the user wants to commit changes via
|
||||||
// their editor rather than via the popup panel
|
// their editor rather than via the popup panel
|
||||||
func (gui *Gui) handleCommitEditorPress() error {
|
func (gui *Gui) handleCommitEditorPress() error {
|
||||||
|
if gui.State.FileManager.GetItemsLength() == 0 {
|
||||||
|
return gui.createErrorPanel(gui.Tr.NoFilesStagedTitle)
|
||||||
|
}
|
||||||
|
|
||||||
if len(gui.stagedFiles()) == 0 {
|
if len(gui.stagedFiles()) == 0 {
|
||||||
return gui.promptToStageAllAndRetry(gui.handleCommitEditorPress)
|
return gui.promptToStageAllAndRetry(gui.handleCommitEditorPress)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user