mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Apply correct styling to root commit in graph
The root commit is special in that it has no parents. So we need to add a pipe that's headed for a commit that doesn't actually exist i.e. the mythical empty tree commit. We're using the actual hash of that pseudo-commit, but it's not being read anywhere.
This commit is contained in:
@ -139,7 +139,7 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod
|
||||
// a traversed spot is one where a current pipe is starting on, ending on, or passing through
|
||||
traversedSpots := set.New[int]()
|
||||
|
||||
if len(commit.Parents) > 0 {
|
||||
if len(commit.Parents) > 0 { // merge commit
|
||||
newPipes = append(newPipes, &Pipe{
|
||||
fromPos: pos,
|
||||
toPos: pos,
|
||||
@ -148,6 +148,15 @@ func getNextPipes(prevPipes []*Pipe, commit *models.Commit, getStyle func(c *mod
|
||||
kind: STARTS,
|
||||
style: getStyle(commit),
|
||||
})
|
||||
} else if len(commit.Parents) == 0 { // root commit
|
||||
newPipes = append(newPipes, &Pipe{
|
||||
fromPos: pos,
|
||||
toPos: pos,
|
||||
fromSha: commit.Sha,
|
||||
toSha: models.EmptyTreeCommitHash,
|
||||
kind: STARTS,
|
||||
style: getStyle(commit),
|
||||
})
|
||||
}
|
||||
|
||||
traversedSpotsForContinuingPipes := set.New[int]()
|
||||
|
Reference in New Issue
Block a user