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

refactor to use generics for file nodes

use less generic names
This commit is contained in:
Jesse Duffield
2022-07-31 19:10:16 +10:00
parent 2ca2acaca5
commit 682be18507
12 changed files with 500 additions and 659 deletions

View File

@ -165,7 +165,7 @@ func (self *CommitFilesController) toggleForPatch(node *filetree.CommitFileNode)
// if there is any file that hasn't been fully added we'll fully add everything,
// otherwise we'll remove everything
adding := node.AnyFile(func(file *models.CommitFile) bool {
adding := node.SomeFile(func(file *models.CommitFile) bool {
return self.git.Patch.PatchManager.GetFileStatus(file.Name, self.context().GetRef().RefName()) != patch.WHOLE
})
@ -203,8 +203,7 @@ func (self *CommitFilesController) toggleForPatch(node *filetree.CommitFileNode)
}
func (self *CommitFilesController) toggleAllForPatch(_ *filetree.CommitFileNode) error {
// not a fan of type assertions but this will be fixed very soon thanks to generics
root := self.context().CommitFileTreeViewModel.Tree().(*filetree.CommitFileNode)
root := self.context().CommitFileTreeViewModel.GetRoot()
return self.toggleForPatch(root)
}