1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-14 11:23:09 +02:00
lazygit/pkg/gui/controllers/helpers/patch_building_helper.go

34 lines
772 B
Go
Raw Normal View History

2022-02-22 11:13:11 +02:00
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
}