mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-11 08:06:25 -04:00
refactor the code
This commit is contained in:
parent
c1f3fd6b3f
commit
515e2d2fa9
|
|
@ -39,11 +39,11 @@ func (c *GitCommand) GenerateGithubPullRequestMap(prs []*models.GithubPullReques
|
|||
prWithStringKey := map[string]models.GithubPullRequest{}
|
||||
|
||||
for _, pr := range prs {
|
||||
prWithStringKey[pr.HeadRepositoryOwner.Login+":"+pr.HeadRefName] = *pr
|
||||
prWithStringKey[pr.UserName()+":"+pr.BranchName()] = *pr
|
||||
}
|
||||
|
||||
for _, branch := range branches {
|
||||
if branch.UpstreamName == "" {
|
||||
if !branch.IsTrackingRemote() {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,8 @@ func (b *BranchListBuilder) obtainBranches() []*models.Branch {
|
|||
}
|
||||
|
||||
// Build the list of branches for the current repo
|
||||
func (b *BranchListBuilder) Build() (branches []*models.Branch) {
|
||||
branches = b.obtainBranches()
|
||||
func (b *BranchListBuilder) Build() []*models.Branch {
|
||||
branches := b.obtainBranches()
|
||||
|
||||
reflogBranches := b.obtainReflogBranches()
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ type GithubPullRequest struct {
|
|||
HeadRepositoryOwner GithubRepositoryOwner `json:"headRepositoryOwner"`
|
||||
}
|
||||
|
||||
func (pr *GithubPullRequest) UserName() string {
|
||||
return pr.HeadRepositoryOwner.Login
|
||||
}
|
||||
|
||||
func (pr *GithubPullRequest) BranchName() string {
|
||||
return pr.HeadRefName
|
||||
}
|
||||
|
||||
type GithubRepositoryOwner struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue