diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-16 15:29:02 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-21 22:07:14 +1100 |
commit | eeb667954fd2df5faf1df227a823dd5720bb3171 (patch) | |
tree | ddc148ee8da975478ffa81405551c0ac5be9ad96 /pkg/commands | |
parent | 8aa1062e0693289188c2fb705f2fa15d014f07a0 (diff) |
trying to use gogit with branches from remotes
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 24 | ||||
-rw-r--r-- | pkg/commands/remote.go | 1 |
2 files changed, 23 insertions, 2 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 40e4bccf7..55f8dddb9 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -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, + Name: goGitRemote.Config().Name, + Urls: goGitRemote.Config().URLs, + Branches: branches, } } return remotes, nil diff --git a/pkg/commands/remote.go b/pkg/commands/remote.go index 7e9e5f6f8..8f2941505 100644 --- a/pkg/commands/remote.go +++ b/pkg/commands/remote.go @@ -5,6 +5,7 @@ type Remote struct { Name string Urls []string Selected bool + Branches []*Branch } // GetDisplayStrings returns the display string of a remote |