Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions pkg/gui/presentation/commits.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand All @@ -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
Expand Down