1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

Make Commit.Parents a getter for an unexported parents field

This is exactly the same as what we did for Hash earlier. And for the same
reason: we want to turn the parents field into a slice of pointers.
This commit is contained in:
Stefan Haller
2025-04-26 19:58:03 +02:00
parent e27bc15bbd
commit 0f1f455edb
4 changed files with 13 additions and 9 deletions

View File

@@ -116,7 +116,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod
return pipe.kind != TERMINATES
})
newPipes := make([]*Pipe, 0, len(currentPipes)+len(commit.Parents))
newPipes := make([]*Pipe, 0, len(currentPipes)+len(commit.Parents()))
// start by assuming that we've got a brand new commit not related to any preceding commit.
// (this only happens when we're doing `git log --all`). These will be tacked onto the far end.
pos := maxPos + 1
@@ -137,7 +137,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod
if commit.IsFirstCommit() {
toHash = models.EmptyTreeCommitHash
} else {
toHash = commit.Parents[0]
toHash = commit.Parents()[0]
}
newPipes = append(newPipes, &Pipe{
fromPos: pos,
@@ -216,7 +216,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod
}
if commit.IsMerge() {
for _, parent := range commit.Parents[1:] {
for _, parent := range commit.Parents()[1:] {
availablePos := getNextAvailablePosForNewPipe()
// need to act as if continuing pipes are going to continue on the same line.
newPipes = append(newPipes, &Pipe{