summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/helpers/cherry_pick_helper.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-03-20 09:24:39 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-03-24 20:14:41 +1100
commite392b9f86ab7683b231de4c1addd1986cffc9d91 (patch)
treebf6e72ba9a8c931df82d64ecbe9fd53556565b39 /pkg/gui/controllers/helpers/cherry_pick_helper.go
parent67a76523fb8029a31fd540fdd5dc9aaf1c2e8473 (diff)
no more filterThenMap
Diffstat (limited to 'pkg/gui/controllers/helpers/cherry_pick_helper.go')
-rw-r--r--pkg/gui/controllers/helpers/cherry_pick_helper.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/pkg/gui/controllers/helpers/cherry_pick_helper.go b/pkg/gui/controllers/helpers/cherry_pick_helper.go
index 9117f24f6..2c9ca301a 100644
--- a/pkg/gui/controllers/helpers/cherry_pick_helper.go
+++ b/pkg/gui/controllers/helpers/cherry_pick_helper.go
@@ -118,14 +118,13 @@ func (self *CherryPickHelper) add(selectedCommit *models.Commit, commitsList []*
commitSet := self.CherryPickedCommitShaSet()
commitSet.Add(selectedCommit.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}
- },
- )
+ cherryPickedCommits := slices.Filter(commitsList, func(commit *models.Commit) bool {
+ return commitSet.Includes(commit.Sha)
+ })
- self.getData().CherryPickedCommits = newCommits
+ self.getData().CherryPickedCommits = slices.Map(cherryPickedCommits, func(commit *models.Commit) *models.Commit {
+ return &models.Commit{Name: commit.Name, Sha: commit.Sha}
+ })
}
// you can only copy from one context at a time, because the order and position of commits matter