diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-19 15:36:46 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-24 20:14:41 +1100 |
commit | eda8f4a5d4302691d99efd066f9851809c984bc0 (patch) | |
tree | 0cb13f767ca52682a62d09314f8d9f2f2c1cd4a1 /pkg/gui/controllers/helpers/cherry_pick_helper.go | |
parent | c7a629c4401ae0d4aad06767c88ce1e9e418dbf3 (diff) |
lots more generics
Diffstat (limited to 'pkg/gui/controllers/helpers/cherry_pick_helper.go')
-rw-r--r-- | pkg/gui/controllers/helpers/cherry_pick_helper.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/gui/controllers/helpers/cherry_pick_helper.go b/pkg/gui/controllers/helpers/cherry_pick_helper.go index e4a9b3e81..c433655d0 100644 --- a/pkg/gui/controllers/helpers/cherry_pick_helper.go +++ b/pkg/gui/controllers/helpers/cherry_pick_helper.go @@ -2,6 +2,7 @@ package helpers import ( "github.com/jesseduffield/generics/set" + "github.com/jesseduffield/generics/slices" "github.com/jesseduffield/lazygit/pkg/commands" "github.com/jesseduffield/lazygit/pkg/commands/models" "github.com/jesseduffield/lazygit/pkg/gui/context" @@ -118,12 +119,12 @@ func (self *CherryPickHelper) add(selectedCommit *models.Commit, commitsList []* commitSet := self.CherryPickedCommitShaSet() commitSet.Add(selectedCommit.Sha) - commitsInSet := lo.Filter(commitsList, func(commit *models.Commit, _ int) bool { - return commitSet.Includes(commit.Sha) - }) - newCommits := lo.Map(commitsInSet, func(commit *models.Commit, _ int) *models.Commit { - return &models.Commit{Name: commit.Name, Sha: commit.Sha} - }) + newCommits := slices.FilterThenMap(commitsList, + func(commit *models.Commit) bool { return commitSet.Includes(commit.Sha) }, + func(commit *models.Commit) *models.Commit { + return &models.Commit{Name: commit.Name, Sha: commit.Sha} + }, + ) self.getData().CherryPickedCommits = newCommits } |