libgit2: make RemoteCallbacks helper public
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>
This commit is contained in:
parent
b7376ce94c
commit
4a23126c6a
|
@ -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,
|
||||
})
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue