Skip to content

Commit

Permalink
fixup! Visualize local branch heads in commits panel
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhaller committed Jul 24, 2023
1 parent f358ed4 commit 9a2e9b9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/gui/context/sub_commits_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,25 @@ func NewSubCommitsContext(
}

getDisplayStrings := func(startIdx int, length int) [][]string {
// This can happen if a sub-commits view is asked to be rerendered while
// it is invisble; for example when switching screen modes, which
// rerenders all views.
if viewModel.GetRef() == nil {
return [][]string{}
}

selectedCommitSha := ""
if c.CurrentContext().GetKey() == SUB_COMMITS_CONTEXT_KEY {
selectedCommit := viewModel.GetSelected()
if selectedCommit != nil {
selectedCommitSha = selectedCommit.Sha
}
}
currentBranchName := ""
if viewModel.GetRef() != nil {
currentBranchName = viewModel.GetRef().RefName()
}
return presentation.GetCommitListDisplayStrings(
c.Common,
c.Model().SubCommits,
c.Model().Branches,
currentBranchName,
viewModel.GetRef().RefName(),
c.State().GetRepoState().GetScreenMode() != types.SCREEN_NORMAL,
c.Modes().CherryPicking.SelectedShaSet(),
c.Modes().Diffing.Ref,
Expand Down

0 comments on commit 9a2e9b9

Please sign in to comment.