mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	trying to use gogit with branches from remotes
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -5,6 +5,7 @@ type Remote struct { | ||||
| 	Name     string | ||||
| 	Urls     []string | ||||
| 	Selected bool | ||||
| 	Branches []*Branch | ||||
| } | ||||
|  | ||||
| // GetDisplayStrings returns the display string of a remote | ||||
|   | ||||
		Reference in New Issue
	
	Block a user