This commit is contained in:
Stefan Kerkmann 2026-08-30 17:00:52 -07:00 committed by GitHub
commit 8204549450
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,7 +76,8 @@ func GetCommitListDisplayStrings(
bisectBounds := getbisectBounds(commits, bisectInfo)
// function expects to be passed the index of the commit in terms of the `commits` slice
var getGraphLine func(int) string
getGraphLine := func(int) string { return "" }
if showGraph {
if len(commits) > 0 && commits[0].Divergence != models.DivergenceNone {
// Showing a divergence log; we know we don't have any rebasing
@ -107,9 +108,9 @@ func GetCommitListDisplayStrings(
allGraphLines = append(allGraphLines, graphLines...)
}
}
if localSectionStart < len(commits) {
if localSectionStart < len(commits) && localSectionStart < endIdx {
// we have some local commits
pipeSets := loadPipesets(commits[localSectionStart:])
pipeSets := loadPipesets(commits[localSectionStart:endIdx])
if localSectionStart < endIdx {
// some of the local commits are visible
graphOffset := max(startIdx, localSectionStart)
@ -128,12 +129,12 @@ func GetCommitListDisplayStrings(
getGraphLine = func(idx int) string {
return allGraphLines[idx-startIdx]
}
} else {
} else if rebaseOffset < endIdx {
// this is where the graph begins (may be beyond the TODO commits depending on startIdx,
// but we'll never include TODO commits as part of the graph because it'll be messy)
graphOffset := max(startIdx, rebaseOffset)
pipeSets := loadPipesets(commits[rebaseOffset:])
pipeSets := loadPipesets(commits[rebaseOffset:endIdx])
pipeSetOffset := max(startIdx-rebaseOffset, 0)
graphPipeSets := pipeSets[pipeSetOffset:max(endIdx-rebaseOffset, 0)]
graphCommits := commits[graphOffset:endIdx]
@ -149,8 +150,6 @@ func GetCommitListDisplayStrings(
return ""
}
}
} else {
getGraphLine = func(int) string { return "" }
}
// Determine the hashes of the local branches for which we want to show a