1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-17 14:11:02 +02:00

trying to use gogit with branches from remotes

This commit is contained in:
Jesse Duffield 2019-11-16 15:29:02 +11:00
parent 8aa1062e06
commit eeb667954f
2 changed files with 23 additions and 2 deletions

View File

@ -1068,12 +1068,32 @@ func (c *GitCommand) GetRemotes() ([]*Remote, error) {
return nil, err
}
return nil, nil
remotes := make([]*Remote, len(goGitRemotes))
// TODO: consider including the goGitRemote itself
for i, goGitRemote := range goGitRemotes {
goGitBranches, err := goGitRemote.List(&gogit.ListOptions{})
if err != nil {
c.Log.Warn(err)
continue
}
branches := []*Branch{}
for _, goGitBranch := range goGitBranches {
// for now we're only getting branch references, not tags/notes/etc
if goGitBranch.Name().IsBranch() {
branches = append(branches, &Branch{
Name: goGitBranch.Name().String(),
})
}
}
remotes[i] = &Remote{
Name: goGitRemote.Config().Name,
Urls: goGitRemote.Config().URLs,
Branches: branches,
}
}
return remotes, nil

View File

@ -5,6 +5,7 @@ type Remote struct {
Name string
Urls []string
Selected bool
Branches []*Branch
}
// GetDisplayStrings returns the display string of a remote