mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
support older versions of git when getting remote branches
This commit is contained in:
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (c *GitCommand) GetRemotes() ([]*Remote, error) {
|
func (c *GitCommand) GetRemotes() ([]*Remote, error) {
|
||||||
// get remote branches
|
// get remote branches
|
||||||
unescaped := "git for-each-ref --format='%(refname:strip=2)' refs/remotes"
|
unescaped := "git branch -r"
|
||||||
remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(unescaped)
|
remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(unescaped)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -25,7 +25,7 @@ func (c *GitCommand) GetRemotes() ([]*Remote, error) {
|
|||||||
for i, goGitRemote := range goGitRemotes {
|
for i, goGitRemote := range goGitRemotes {
|
||||||
remoteName := goGitRemote.Config().Name
|
remoteName := goGitRemote.Config().Name
|
||||||
|
|
||||||
re := regexp.MustCompile(fmt.Sprintf("%s\\/(.*)", remoteName))
|
re := regexp.MustCompile(fmt.Sprintf(`%s\/([\S]+)`, remoteName))
|
||||||
matches := re.FindAllStringSubmatch(remoteBranchesStr, -1)
|
matches := re.FindAllStringSubmatch(remoteBranchesStr, -1)
|
||||||
branches := make([]*RemoteBranch, len(matches))
|
branches := make([]*RemoteBranch, len(matches))
|
||||||
for j, match := range matches {
|
for j, match := range matches {
|
||||||
|
Reference in New Issue
Block a user