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

introduce Ref interface

This commit is contained in:
Ryooooooga
2022-03-26 22:18:08 +09:00
committed by Jesse Duffield
parent 30be50b641
commit 4835fc00b8
23 changed files with 85 additions and 179 deletions

View File

@ -13,8 +13,8 @@ type ICommitFileTreeViewModel interface {
ICommitFileTree
types.IListCursor
GetRefName() string
SetRefName(string)
GetRef() types.Ref
SetRef(types.Ref)
GetCanRebase() bool
SetCanRebase(bool)
}
@ -24,8 +24,8 @@ type CommitFileTreeViewModel struct {
ICommitFileTree
types.IListCursor
// this is e.g. the commit SHA of the commit for which we're viewing the files
refName string
// this is e.g. the commit for which we're viewing the files
ref types.Ref
// we set this to true when you're viewing the files within the checked-out branch's commits.
// If you're viewing the files of some random other branch we can't do any rebase stuff.
@ -40,17 +40,17 @@ func NewCommitFileTreeViewModel(getFiles func() []*models.CommitFile, log *logru
return &CommitFileTreeViewModel{
ICommitFileTree: fileTree,
IListCursor: listCursor,
refName: "",
ref: nil,
canRebase: false,
}
}
func (self *CommitFileTreeViewModel) GetRefName() string {
return self.refName
func (self *CommitFileTreeViewModel) GetRef() types.Ref {
return self.ref
}
func (self *CommitFileTreeViewModel) SetRefName(refName string) {
self.refName = refName
func (self *CommitFileTreeViewModel) SetRef(ref types.Ref) {
self.ref = ref
}
func (self *CommitFileTreeViewModel) GetCanRebase() bool {