mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-15 11:56:37 +02:00
trying to use gogit with branches from remotes
This commit is contained in:
parent
8aa1062e06
commit
eeb667954f
@ -1068,12 +1068,32 @@ func (c *GitCommand) GetRemotes() ([]*Remote, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil, nil
|
||||||
|
|
||||||
remotes := make([]*Remote, len(goGitRemotes))
|
remotes := make([]*Remote, len(goGitRemotes))
|
||||||
|
|
||||||
// TODO: consider including the goGitRemote itself
|
// TODO: consider including the goGitRemote itself
|
||||||
for i, goGitRemote := range goGitRemotes {
|
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{
|
remotes[i] = &Remote{
|
||||||
Name: goGitRemote.Config().Name,
|
Name: goGitRemote.Config().Name,
|
||||||
Urls: goGitRemote.Config().URLs,
|
Urls: goGitRemote.Config().URLs,
|
||||||
|
Branches: branches,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return remotes, nil
|
return remotes, nil
|
||||||
|
@ -5,6 +5,7 @@ type Remote struct {
|
|||||||
Name string
|
Name string
|
||||||
Urls []string
|
Urls []string
|
||||||
Selected bool
|
Selected bool
|
||||||
|
Branches []*Branch
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDisplayStrings returns the display string of a remote
|
// GetDisplayStrings returns the display string of a remote
|
||||||
|
Loading…
x
Reference in New Issue
Block a user