1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-06 22:33:07 +02:00

Move the Ref interface from gui/types to models

This is a type that can be useful for model/backend stuff, so move it there. We
are going to use it in the API of the commit loader.
This commit is contained in:
Stefan Haller
2025-07-31 11:20:05 +02:00
parent cc0b5a2f7f
commit 4b9921d0a4
15 changed files with 35 additions and 30 deletions

View File

@ -15,8 +15,8 @@ type ICommitFileTreeViewModel interface {
ICommitFileTree
types.IListCursor
GetRef() types.Ref
SetRef(types.Ref)
GetRef() models.Ref
SetRef(models.Ref)
GetRefRange() *types.RefRange // can be nil, in which case GetRef should be used
SetRefRange(*types.RefRange) // should be set to nil when selection is not a range
GetCanRebase() bool
@ -30,7 +30,7 @@ type CommitFileTreeViewModel struct {
// this is e.g. the commit for which we're viewing the files, if there is no
// range selection, or if the range selection can't be used for some reason
ref types.Ref
ref models.Ref
// this is a commit range for which we're viewing the files. Can be nil, in
// which case ref is used.
@ -55,11 +55,11 @@ func NewCommitFileTreeViewModel(getFiles func() []*models.CommitFile, common *co
}
}
func (self *CommitFileTreeViewModel) GetRef() types.Ref {
func (self *CommitFileTreeViewModel) GetRef() models.Ref {
return self.ref
}
func (self *CommitFileTreeViewModel) SetRef(ref types.Ref) {
func (self *CommitFileTreeViewModel) SetRef(ref models.Ref) {
self.ref = ref
}