diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-26 21:29:56 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-26 21:36:07 +1100 |
commit | 7113ed73d4d776f0a0f19e715a717e0394ac3651 (patch) | |
tree | fdd940618c652c5fd41175b039ce209d164d35b1 /pkg/commands | |
parent | 3dd1daacdc99b7eb9c4828154c7ece436beb98f4 (diff) |
support older versions of git when getting remote branches
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/loading_remotes.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/commands/loading_remotes.go b/pkg/commands/loading_remotes.go index a56e8571a..26dea0f70 100644 --- a/pkg/commands/loading_remotes.go +++ b/pkg/commands/loading_remotes.go @@ -9,7 +9,7 @@ import ( func (c *GitCommand) GetRemotes() ([]*Remote, error) { // get remote branches - unescaped := "git for-each-ref --format='%(refname:strip=2)' refs/remotes" + unescaped := "git branch -r" remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(unescaped) if err != nil { return nil, err @@ -25,7 +25,7 @@ func (c *GitCommand) GetRemotes() ([]*Remote, error) { for i, goGitRemote := range goGitRemotes { remoteName := goGitRemote.Config().Name - re := regexp.MustCompile(fmt.Sprintf("%s\\/(.*)", remoteName)) + re := regexp.MustCompile(fmt.Sprintf(`%s\/([\S]+)`, remoteName)) matches := re.FindAllStringSubmatch(remoteBranchesStr, -1) branches := make([]*RemoteBranch, len(matches)) for j, match := range matches { |