Skip to content

Commit c6832d2

Browse files
committed
🤫 resolving git refs func
1 parent faf3b07 commit c6832d2

File tree

1 file changed

+7
-7
lines changed
  • cyclops-ctrl/internal/template

1 file changed

+7
-7
lines changed

cyclops-ctrl/internal/template/git.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"bytes"
66
"encoding/json"
77
"fmt"
8-
"github.com/cyclops-ui/cycops-ctrl/internal/auth"
9-
"github.com/go-git/go-git/v5/plumbing/transport/http"
108
"io"
119
path2 "path"
1210
"path/filepath"
@@ -17,11 +15,13 @@ import (
1715
"github.com/go-git/go-git/v5"
1816
"github.com/go-git/go-git/v5/config"
1917
"github.com/go-git/go-git/v5/plumbing"
18+
"github.com/go-git/go-git/v5/plumbing/transport/http"
2019
"github.com/go-git/go-git/v5/storage/memory"
2120
"github.com/pkg/errors"
2221
"gopkg.in/yaml.v2"
2322
"helm.sh/helm/v3/pkg/chart"
2423

24+
"github.com/cyclops-ui/cycops-ctrl/internal/auth"
2525
"github.com/cyclops-ui/cycops-ctrl/internal/mapper"
2626
"github.com/cyclops-ui/cycops-ctrl/internal/models"
2727
"github.com/cyclops-ui/cycops-ctrl/internal/models/helm"
@@ -33,7 +33,7 @@ func (r Repo) LoadTemplate(repoURL, path, commit string) (*models.Template, erro
3333
return nil, err
3434
}
3535

36-
commitSHA, err := r.resolveRef(repoURL, commit, creds)
36+
commitSHA, err := resolveRef(repoURL, commit, creds)
3737
if err != nil {
3838
return nil, err
3939
}
@@ -139,7 +139,7 @@ func (r Repo) LoadInitialTemplateValues(repoURL, path, commit string) (map[inter
139139
return nil, err
140140
}
141141

142-
commitSHA, err := r.resolveRef(repoURL, commit, creds)
142+
commitSHA, err := resolveRef(repoURL, commit, creds)
143143
if err != nil {
144144
return nil, err
145145
}
@@ -204,9 +204,9 @@ func (r Repo) LoadInitialTemplateValues(repoURL, path, commit string) (map[inter
204204
return initialValues, nil
205205
}
206206

207-
func (r Repo) resolveRef(repo, version string, creds *auth.Credentials) (string, error) {
207+
func resolveRef(repo, version string, creds *auth.Credentials) (string, error) {
208208
if len(version) == 0 {
209-
return r.resolveDefaultBranchRef(repo, creds)
209+
return resolveDefaultBranchRef(repo, creds)
210210
}
211211

212212
rem := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{
@@ -233,7 +233,7 @@ func (r Repo) resolveRef(repo, version string, creds *auth.Credentials) (string,
233233
return version, nil
234234
}
235235

236-
func (r Repo) resolveDefaultBranchRef(repo string, creds *auth.Credentials) (string, error) {
236+
func resolveDefaultBranchRef(repo string, creds *auth.Credentials) (string, error) {
237237
rem := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{
238238
Name: "origin",
239239
URLs: []string{repo},

0 commit comments

Comments
 (0)