diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-09-29 18:41:06 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-09-29 20:48:49 +1000 |
commit | eda4619a4f05b6720d091b31e60515f7289b9a47 (patch) | |
tree | 86c39ebf92ffc21c5abe751a6faf151788083242 /pkg/commands/loading_remotes.go | |
parent | e849ca337237f564dd90a09e40b9ca8f9d62352a (diff) |
move remotes and remote branches
Diffstat (limited to 'pkg/commands/loading_remotes.go')
-rw-r--r-- | pkg/commands/loading_remotes.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pkg/commands/loading_remotes.go b/pkg/commands/loading_remotes.go index 26dea0f70..f1f95b52e 100644 --- a/pkg/commands/loading_remotes.go +++ b/pkg/commands/loading_remotes.go @@ -5,9 +5,11 @@ import ( "regexp" "sort" "strings" + + "github.com/jesseduffield/lazygit/pkg/models" ) -func (c *GitCommand) GetRemotes() ([]*Remote, error) { +func (c *GitCommand) GetRemotes() ([]*models.Remote, error) { // get remote branches unescaped := "git branch -r" remoteBranchesStr, err := c.OSCommand.RunCommandWithOutput(unescaped) @@ -21,21 +23,21 @@ func (c *GitCommand) GetRemotes() ([]*Remote, error) { } // first step is to get our remotes from go-git - remotes := make([]*Remote, len(goGitRemotes)) + remotes := make([]*models.Remote, len(goGitRemotes)) for i, goGitRemote := range goGitRemotes { remoteName := goGitRemote.Config().Name re := regexp.MustCompile(fmt.Sprintf(`%s\/([\S]+)`, remoteName)) matches := re.FindAllStringSubmatch(remoteBranchesStr, -1) - branches := make([]*RemoteBranch, len(matches)) + branches := make([]*models.RemoteBranch, len(matches)) for j, match := range matches { - branches[j] = &RemoteBranch{ + branches[j] = &models.RemoteBranch{ Name: match[1], RemoteName: remoteName, } } - remotes[i] = &Remote{ + remotes[i] = &models.Remote{ Name: goGitRemote.Config().Name, Urls: goGitRemote.Config().URLs, Branches: branches, |