1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

add commit files controller

This commit is contained in:
Jesse Duffield
2022-02-22 20:13:11 +11:00
parent 85f2319897
commit ecaff7fc6c
13 changed files with 358 additions and 321 deletions

View File

@ -10,6 +10,7 @@ type Helpers struct {
MergeAndRebase *MergeAndRebaseHelper
CherryPick *CherryPickHelper
Host *HostHelper
PatchBuilding *PatchBuildingHelper
}
func NewStubHelpers() *Helpers {
@ -23,5 +24,6 @@ func NewStubHelpers() *Helpers {
MergeAndRebase: &MergeAndRebaseHelper{},
CherryPick: &CherryPickHelper{},
Host: &HostHelper{},
PatchBuilding: &PatchBuildingHelper{},
}
}

View File

@ -0,0 +1,33 @@
package helpers
import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
"github.com/jesseduffield/lazygit/pkg/gui/types"
)
type IPatchBuildingHelper interface {
ValidateNormalWorkingTreeState() (bool, error)
}
type PatchBuildingHelper struct {
c *types.HelperCommon
git *commands.GitCommand
}
func NewPatchBuildingHelper(
c *types.HelperCommon,
git *commands.GitCommand,
) *PatchBuildingHelper {
return &PatchBuildingHelper{
c: c,
git: git,
}
}
func (self *PatchBuildingHelper) ValidateNormalWorkingTreeState() (bool, error) {
if self.git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE {
return false, self.c.ErrorMsg(self.c.Tr.CantPatchWhileRebasingError)
}
return true, nil
}