1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-23 00:39:13 +02:00

support detached heads when showing the selected branch

This commit is contained in:
Jesse Duffield
2019-11-17 12:07:36 +11:00
parent 6b7aaeca45
commit 55ff0c0dee
5 changed files with 39 additions and 7 deletions

View File

@ -22,14 +22,15 @@ func (c *GitCommand) GetRemotes() ([]*Remote, error) {
// first step is to get our remotes from go-git
remotes := make([]*Remote, len(goGitRemotes))
for i, goGitRemote := range goGitRemotes {
name := goGitRemote.Config().Name
remoteName := goGitRemote.Config().Name
re := regexp.MustCompile(fmt.Sprintf("%s\\/(.*)", name))
re := regexp.MustCompile(fmt.Sprintf("%s\\/(.*)", remoteName))
matches := re.FindAllStringSubmatch(remoteBranchesStr, -1)
branches := make([]*RemoteBranch, len(matches))
for j, match := range matches {
branches[j] = &RemoteBranch{
Name: match[1],
Name: match[1],
RemoteName: remoteName,
}
}