mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-10 04:07:18 +02:00
👌 update as per PR commentary
This commit is contained in:
parent
196761a40a
commit
860370a845
@ -301,19 +301,26 @@ func (gui *Gui) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
|
||||
return &cfg
|
||||
}
|
||||
|
||||
func (gui *Gui) canCommitNow() bool {
|
||||
if len(gui.stagedFiles()) > 0 {
|
||||
return true
|
||||
}
|
||||
if gui.Config.GetUserConfig().Gui.SkipNoStagedFilesWarning {
|
||||
func (gui *Gui) prepareFilesForCommit() error {
|
||||
noStagedFiles := len(gui.stagedFiles()) == 0
|
||||
if noStagedFiles && gui.Config.GetUserConfig().Gui.SkipNoStagedFilesWarning {
|
||||
err := gui.GitCommand.StageAll()
|
||||
return err == nil
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return false
|
||||
|
||||
return gui.refreshFilesAndSubmodules()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gui *Gui) handleCommitPress() error {
|
||||
if !gui.canCommitNow() {
|
||||
if err := gui.prepareFilesForCommit(); err != nil {
|
||||
return gui.surfaceError(err)
|
||||
}
|
||||
|
||||
if len(gui.stagedFiles()) == 0 {
|
||||
return gui.promptToStageAllAndRetry(gui.handleCommitPress)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user