1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Make DisabledReason a struct

This is a pure refactoring, no change in behavior yet. We'll add another field
to the struct in the next commit.
This commit is contained in:
Stefan Haller
2024-01-13 20:02:10 +01:00
parent 09a24ee97d
commit 84e1d15079
10 changed files with 73 additions and 69 deletions

View File

@ -59,16 +59,16 @@ func (self *SyncController) HandlePull() error {
return self.branchCheckedOut(self.pull)()
}
func (self *SyncController) getDisabledReasonForPushOrPull() string {
func (self *SyncController) getDisabledReasonForPushOrPull() *types.DisabledReason {
currentBranch := self.c.Helpers().Refs.GetCheckedOutRef()
if currentBranch != nil {
op := self.c.State().GetItemOperation(currentBranch)
if op != types.ItemOperationNone {
return self.c.Tr.CantPullOrPushSameBranchTwice
return &types.DisabledReason{Text: self.c.Tr.CantPullOrPushSameBranchTwice}
}
}
return ""
return nil
}
func (self *SyncController) branchCheckedOut(f func(*models.Branch) error) func() error {