From 05b3ae952407e42aa1b7a42186886bbd9302d6f1 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 8 Oct 2024 17:46:54 +0200 Subject: [PATCH] Reference original commits in CherryPicking mode instead of synthesizing new ones Previously we would create new Commit objects to store in the CherryPicking mode which only contained a name and hash, all other fields were unset. I'm not sure why we did this; it's easier to just reference the original commits. Later on this branch we will need this because we need to determine whether a copied commit was a merge commit (by looking at its Parents field). --- pkg/gui/modes/cherrypicking/cherry_picking.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/gui/modes/cherrypicking/cherry_picking.go b/pkg/gui/modes/cherrypicking/cherry_picking.go index d84cec39a..82dae3323 100644 --- a/pkg/gui/modes/cherrypicking/cherry_picking.go +++ b/pkg/gui/modes/cherrypicking/cherry_picking.go @@ -59,11 +59,7 @@ func (self *CherryPicking) Remove(selectedCommit *models.Commit, commitsList []* } func (self *CherryPicking) update(selectedHashSet *set.Set[string], commitsList []*models.Commit) { - cherryPickedCommits := lo.Filter(commitsList, func(commit *models.Commit, _ int) bool { + self.CherryPickedCommits = lo.Filter(commitsList, func(commit *models.Commit, _ int) bool { return selectedHashSet.Includes(commit.Hash) }) - - self.CherryPickedCommits = lo.Map(cherryPickedCommits, func(commit *models.Commit, _ int) *models.Commit { - return &models.Commit{Name: commit.Name, Hash: commit.Hash} - }) }