Rename Git packages to implementations
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
aaee43338e
commit
7e63ef841c
|
@ -25,9 +25,10 @@ import (
|
|||
const (
|
||||
// GitRepositoryKind is the string representation of a GitRepository.
|
||||
GitRepositoryKind = "GitRepository"
|
||||
// GoGitImplementation represents the go-git git implementation kind.
|
||||
|
||||
// GoGitImplementation represents the go-git Git implementation kind.
|
||||
GoGitImplementation = "go-git"
|
||||
// LibGit2Implementation represents the gi2go git implementation kind.
|
||||
// LibGit2Implementation represents the git2go Git implementation kind.
|
||||
LibGit2Implementation = "libgit2"
|
||||
)
|
||||
|
||||
|
|
|
@ -21,20 +21,16 @@ import (
|
|||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/fluxcd/source-controller/pkg/git/common"
|
||||
gitv1 "github.com/fluxcd/source-controller/pkg/git/v1"
|
||||
gitv2 "github.com/fluxcd/source-controller/pkg/git/v2"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultBranch = "master"
|
||||
"github.com/fluxcd/source-controller/pkg/git/gogit"
|
||||
"github.com/fluxcd/source-controller/pkg/git/libgit2"
|
||||
)
|
||||
|
||||
func CheckoutStrategyForRef(ref *sourcev1.GitRepositoryRef, gitImplementation string) (common.CheckoutStrategy, error) {
|
||||
switch gitImplementation {
|
||||
case sourcev1.GoGitImplementation:
|
||||
return gitv1.CheckoutStrategyForRef(ref), nil
|
||||
return gogit.CheckoutStrategyForRef(ref), nil
|
||||
case sourcev1.LibGit2Implementation:
|
||||
return gitv2.CheckoutStrategyForRef(ref), nil
|
||||
return libgit2.CheckoutStrategyForRef(ref), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid git implementation %s", gitImplementation)
|
||||
}
|
||||
|
@ -43,9 +39,9 @@ func CheckoutStrategyForRef(ref *sourcev1.GitRepositoryRef, gitImplementation st
|
|||
func AuthSecretStrategyForURL(url string, gitImplementation string) (common.AuthSecretStrategy, error) {
|
||||
switch gitImplementation {
|
||||
case sourcev1.GoGitImplementation:
|
||||
return gitv1.AuthSecretStrategyForURL(url)
|
||||
return gogit.AuthSecretStrategyForURL(url)
|
||||
case sourcev1.LibGit2Implementation:
|
||||
return gitv2.AuthSecretStrategyForURL(url)
|
||||
return libgit2.AuthSecretStrategyForURL(url)
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid git implementation %s", gitImplementation)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
package gogit
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/go-git/go-git/v5/plumbing"
|
||||
|
||||
"github.com/fluxcd/pkg/version"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||
"github.com/fluxcd/source-controller/pkg/git/common"
|
||||
)
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
package gogit
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
package gogit
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
package gogit
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -25,6 +25,7 @@ import (
|
|||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/fluxcd/pkg/ssh/knownhosts"
|
||||
|
||||
"github.com/fluxcd/source-controller/pkg/git/common"
|
||||
)
|
||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1
|
||||
package gogit
|
||||
|
||||
import (
|
||||
"reflect"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v2
|
||||
package libgit2
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v2
|
||||
package libgit2
|
||||
|
||||
import (
|
||||
"context"
|
|
@ -14,14 +14,15 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v2
|
||||
package libgit2
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/crypto/openpgp"
|
||||
|
||||
git2go "github.com/libgit2/git2go/v31"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v2
|
||||
package libgit2
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
@ -27,9 +27,10 @@ import (
|
|||
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
||||
"github.com/fluxcd/source-controller/pkg/git/common"
|
||||
git2go "github.com/libgit2/git2go/v31"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/fluxcd/source-controller/pkg/git/common"
|
||||
)
|
||||
|
||||
func AuthSecretStrategyForURL(URL string) (common.AuthSecretStrategy, error) {
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v2
|
||||
package libgit2
|
||||
|
||||
import (
|
||||
"reflect"
|
Loading…
Reference in New Issue