Skip to content

Commit

Permalink
libgit2: make RemoteCallbacks helper public
Browse files Browse the repository at this point in the history
Main requirement for this is the image-automation-controller
depending on being able to get a working auth configuration.

Once the package is moved, we should add push logic to it,
so that the controller is able to use that instead.

Signed-off-by: Hidde Beydals <hello@hidde.co>
  • Loading branch information
hiddeco committed Oct 24, 2021
1 parent ee257f6 commit d9a8004
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions pkg/git/libgit2/checkout.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (c *CheckoutBranch) Checkout(ctx context.Context, path, url string, opts *g
repo, err := git2go.Clone(url, path, &git2go.CloneOptions{
FetchOptions: &git2go.FetchOptions{
DownloadTags: git2go.DownloadTagsNone,
RemoteCallbacks: remoteCallbacks(opts),
RemoteCallbacks: RemoteCallbacks(opts),
},
CheckoutBranch: c.Branch,
})
Expand Down Expand Up @@ -92,7 +92,7 @@ func (c *CheckoutTag) Checkout(ctx context.Context, path, url string, opts *git.
repo, err := git2go.Clone(url, path, &git2go.CloneOptions{
FetchOptions: &git2go.FetchOptions{
DownloadTags: git2go.DownloadTagsAll,
RemoteCallbacks: remoteCallbacks(opts),
RemoteCallbacks: RemoteCallbacks(opts),
},
})
if err != nil {
Expand All @@ -115,7 +115,7 @@ func (c *CheckoutCommit) Checkout(ctx context.Context, path, url string, opts *g
repo, err := git2go.Clone(url, path, &git2go.CloneOptions{
FetchOptions: &git2go.FetchOptions{
DownloadTags: git2go.DownloadTagsNone,
RemoteCallbacks: remoteCallbacks(opts),
RemoteCallbacks: RemoteCallbacks(opts),
},
})
if err != nil {
Expand Down Expand Up @@ -146,7 +146,7 @@ func (c *CheckoutSemVer) Checkout(ctx context.Context, path, url string, opts *g
repo, err := git2go.Clone(url, path, &git2go.CloneOptions{
FetchOptions: &git2go.FetchOptions{
DownloadTags: git2go.DownloadTagsAll,
RemoteCallbacks: remoteCallbacks(opts),
RemoteCallbacks: RemoteCallbacks(opts),
},
})
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/git/libgit2/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ var (
now = time.Now
)

// remoteCallbacks constructs RemoteCallbacks with credentialsCallback and
// RemoteCallbacks constructs RemoteCallbacks with credentialsCallback and
// certificateCallback, and the given options if the given opts is not nil.
func remoteCallbacks(opts *git.AuthOptions) git2go.RemoteCallbacks {
func RemoteCallbacks(opts *git.AuthOptions) git2go.RemoteCallbacks {
if opts != nil {
return git2go.RemoteCallbacks{
CredentialsCallback: credentialsCallback(opts),
Expand Down

0 comments on commit d9a8004

Please sign in to comment.