gitrepo: match against api types when creating git client
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
This commit is contained in:
parent
d25ed0c8c4
commit
22e712b935
|
@ -768,10 +768,13 @@ func (r *GitRepositoryReconciler) gitCheckout(ctx context.Context,
|
|||
var gitReader git.RepositoryReader
|
||||
var err error
|
||||
|
||||
if obj.Spec.GitImplementation == libgit2.ClientName {
|
||||
switch obj.Spec.GitImplementation {
|
||||
case sourcev1.LibGit2Implementation:
|
||||
gitReader, err = libgit2.NewClient(dir, authOpts)
|
||||
} else {
|
||||
case sourcev1.GoGitImplementation, "":
|
||||
gitReader, err = gogit.NewClient(dir, authOpts)
|
||||
default:
|
||||
err = fmt.Errorf("invalid Git implementation: %s", obj.Spec.GitImplementation)
|
||||
}
|
||||
if err != nil {
|
||||
// Do not return err as recovery without changes is impossible.
|
||||
|
|
Loading…
Reference in New Issue