mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 16:16:28 -04:00
remove BranchesWithGithubPullRequests check
This commit is contained in:
parent
b36f6db521
commit
d2e75a6359
|
|
@ -21,20 +21,18 @@ func (c *GitCommand) GithubMostRecentPRs() ([]*models.GithubPullRequest, error)
|
|||
return prs, nil
|
||||
}
|
||||
|
||||
func (c *GitCommand) GenerateGithubPullRequestMap(prs []*models.GithubPullRequest, branches []*models.Branch) (map[*models.Branch]*models.GithubPullRequest, bool) {
|
||||
func (c *GitCommand) GenerateGithubPullRequestMap(prs []*models.GithubPullRequest, branches []*models.Branch) map[*models.Branch]*models.GithubPullRequest {
|
||||
res := map[*models.Branch]*models.GithubPullRequest{}
|
||||
|
||||
if len(prs) == 0 {
|
||||
return res, false
|
||||
return res
|
||||
}
|
||||
|
||||
remotesToOwnersMap, _ := c.GetRemotesToOwnersMap()
|
||||
if len(remotesToOwnersMap) == 0 {
|
||||
return res, false
|
||||
return res
|
||||
}
|
||||
|
||||
foundBranchWithGithubPullRequest := false
|
||||
|
||||
prWithStringKey := map[string]models.GithubPullRequest{}
|
||||
|
||||
for _, pr := range prs {
|
||||
|
|
@ -56,10 +54,8 @@ func (c *GitCommand) GenerateGithubPullRequestMap(prs []*models.GithubPullReques
|
|||
continue
|
||||
}
|
||||
|
||||
foundBranchWithGithubPullRequest = true
|
||||
|
||||
res[branch] = &pr
|
||||
}
|
||||
|
||||
return res, foundBranchWithGithubPullRequest
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@ func (gui *Gui) refreshBranches() {
|
|||
_ = gui.surfaceError(err)
|
||||
}
|
||||
gui.State.Branches = builder.Build()
|
||||
_, branchesWithGithubPullRequests := builder.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, gui.State.Branches)
|
||||
gui.State.BranchesWithGithubPullRequests = branchesWithGithubPullRequests
|
||||
|
||||
if err := gui.postRefreshUpdate(gui.State.Contexts.Branches); err != nil {
|
||||
gui.Log.Error(err)
|
||||
|
|
|
|||
|
|
@ -74,9 +74,6 @@ func (gui *Gui) refreshReflogCommitsConsideringStartup() {
|
|||
// The github cli can be quite slow so we load the github PRs sparately
|
||||
gui.refreshGithubPullRequests()
|
||||
wg.Wait()
|
||||
_, branchesWithGithubPullRequests := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, gui.State.Branches)
|
||||
gui.State.BranchesWithGithubPullRequests = branchesWithGithubPullRequests
|
||||
|
||||
_ = gui.postRefreshUpdate(gui.State.Contexts.Branches)
|
||||
})
|
||||
case COMPLETE:
|
||||
|
|
|
|||
|
|
@ -287,14 +287,13 @@ type guiMutexes struct {
|
|||
type guiState struct {
|
||||
// the file panels (files and commit files) can render as a tree, so we have
|
||||
// managers for them which handle rendering a flat list of files in tree form
|
||||
FileManager *filetree.FileManager
|
||||
CommitFileManager *filetree.CommitFileManager
|
||||
Submodules []*models.SubmoduleConfig
|
||||
Branches []*models.Branch
|
||||
GithubRecentPRs []*models.GithubPullRequest
|
||||
BranchesWithGithubPullRequests bool
|
||||
Commits []*models.Commit
|
||||
StashEntries []*models.StashEntry
|
||||
FileManager *filetree.FileManager
|
||||
CommitFileManager *filetree.CommitFileManager
|
||||
Submodules []*models.SubmoduleConfig
|
||||
Branches []*models.Branch
|
||||
GithubRecentPRs []*models.GithubPullRequest
|
||||
Commits []*models.Commit
|
||||
StashEntries []*models.StashEntry
|
||||
// Suggestions will sometimes appear when typing into a prompt
|
||||
Suggestions []*types.Suggestion
|
||||
// FilteredReflogCommits are the ones that appear in the reflog panel.
|
||||
|
|
@ -733,7 +732,7 @@ func (gui *Gui) setColorScheme() error {
|
|||
}
|
||||
|
||||
func (gui *Gui) GetPr(branch *models.Branch) (*models.GithubPullRequest, bool) {
|
||||
prs, _ := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, []*models.Branch{branch})
|
||||
prs := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, []*models.Branch{branch})
|
||||
pr, hasPr := prs[branch]
|
||||
|
||||
return pr, hasPr
|
||||
|
|
|
|||
|
|
@ -66,15 +66,13 @@ func (gui *Gui) branchesListContext() *ListContext {
|
|||
OnFocus: gui.handleBranchSelect,
|
||||
Gui: gui,
|
||||
GetDisplayStrings: func() [][]string {
|
||||
prs, branchesWithGithubPullRequests := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, gui.State.Branches)
|
||||
gui.State.BranchesWithGithubPullRequests = branchesWithGithubPullRequests
|
||||
prs := gui.GitCommand.GenerateGithubPullRequestMap(gui.State.GithubRecentPRs, gui.State.Branches)
|
||||
|
||||
return presentation.GetBranchListDisplayStrings(
|
||||
gui.State.Branches,
|
||||
prs,
|
||||
gui.State.ScreenMode != SCREEN_NORMAL,
|
||||
gui.State.Modes.Diffing.Ref,
|
||||
gui.State.BranchesWithGithubPullRequests,
|
||||
)
|
||||
},
|
||||
SelectedItem: func() (ListItem, bool) {
|
||||
|
|
|
|||
|
|
@ -14,13 +14,12 @@ func GetBranchListDisplayStrings(
|
|||
branches []*models.Branch,
|
||||
prs map[*models.Branch]*models.GithubPullRequest,
|
||||
fullDescription bool,
|
||||
diffName string,
|
||||
showGithub bool) [][]string {
|
||||
diffName string) [][]string {
|
||||
lines := make([][]string, len(branches))
|
||||
|
||||
for i := range branches {
|
||||
diffed := branches[i].Name == diffName
|
||||
lines[i] = getBranchDisplayStrings(branches[i], prs, fullDescription, diffed, showGithub)
|
||||
lines[i] = getBranchDisplayStrings(branches[i], prs, fullDescription, diffed)
|
||||
}
|
||||
|
||||
return lines
|
||||
|
|
@ -31,8 +30,7 @@ func getBranchDisplayStrings(
|
|||
b *models.Branch,
|
||||
prs map[*models.Branch]*models.GithubPullRequest,
|
||||
fullDescription bool,
|
||||
diffed,
|
||||
showGithub bool) []string {
|
||||
diffed bool) []string {
|
||||
displayName := b.Name
|
||||
if b.DisplayName != "" {
|
||||
displayName = b.DisplayName
|
||||
|
|
@ -53,10 +51,8 @@ func getBranchDisplayStrings(
|
|||
}
|
||||
|
||||
res := []string{recencyColor.Sprint(b.Recency), coloredName}
|
||||
if showGithub {
|
||||
pr, hasPr := prs[b]
|
||||
res = append(res, coloredPrNumber(pr, hasPr))
|
||||
}
|
||||
pr, hasPr := prs[b]
|
||||
res = append(res, coloredPrNumber(pr, hasPr))
|
||||
|
||||
if fullDescription {
|
||||
return append(res, style.FgYellow.Sprint(b.UpstreamName))
|
||||
|
|
@ -107,5 +103,5 @@ func coloredPrNumber(pr *models.GithubPullRequest, hasPr bool) string {
|
|||
return colour.Sprint("#" + strconv.Itoa(pr.Number))
|
||||
}
|
||||
|
||||
return ""
|
||||
return ("")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue