Skip to content

Commit 7e63ef8

Browse files
committed
Rename Git packages to implementations
Signed-off-by: Hidde Beydals <[email protected]>
1 parent aaee433 commit 7e63ef8

File tree

12 files changed

+25
-24
lines changed

12 files changed

+25
-24
lines changed

api/v1beta1/gitrepository_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import (
2525
const (
2626
// GitRepositoryKind is the string representation of a GitRepository.
2727
GitRepositoryKind = "GitRepository"
28-
// GoGitImplementation represents the go-git git implementation kind.
28+
29+
// GoGitImplementation represents the go-git Git implementation kind.
2930
GoGitImplementation = "go-git"
30-
// LibGit2Implementation represents the gi2go git implementation kind.
31+
// LibGit2Implementation represents the git2go Git implementation kind.
3132
LibGit2Implementation = "libgit2"
3233
)
3334

pkg/git/git.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,16 @@ import (
2121

2222
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
2323
"github.com/fluxcd/source-controller/pkg/git/common"
24-
gitv1 "github.com/fluxcd/source-controller/pkg/git/v1"
25-
gitv2 "github.com/fluxcd/source-controller/pkg/git/v2"
26-
)
27-
28-
const (
29-
defaultBranch = "master"
24+
"github.com/fluxcd/source-controller/pkg/git/gogit"
25+
"github.com/fluxcd/source-controller/pkg/git/libgit2"
3026
)
3127

3228
func CheckoutStrategyForRef(ref *sourcev1.GitRepositoryRef, gitImplementation string) (common.CheckoutStrategy, error) {
3329
switch gitImplementation {
3430
case sourcev1.GoGitImplementation:
35-
return gitv1.CheckoutStrategyForRef(ref), nil
31+
return gogit.CheckoutStrategyForRef(ref), nil
3632
case sourcev1.LibGit2Implementation:
37-
return gitv2.CheckoutStrategyForRef(ref), nil
33+
return libgit2.CheckoutStrategyForRef(ref), nil
3834
default:
3935
return nil, fmt.Errorf("invalid git implementation %s", gitImplementation)
4036
}
@@ -43,9 +39,9 @@ func CheckoutStrategyForRef(ref *sourcev1.GitRepositoryRef, gitImplementation st
4339
func AuthSecretStrategyForURL(url string, gitImplementation string) (common.AuthSecretStrategy, error) {
4440
switch gitImplementation {
4541
case sourcev1.GoGitImplementation:
46-
return gitv1.AuthSecretStrategyForURL(url)
42+
return gogit.AuthSecretStrategyForURL(url)
4743
case sourcev1.LibGit2Implementation:
48-
return gitv2.AuthSecretStrategyForURL(url)
44+
return libgit2.AuthSecretStrategyForURL(url)
4945
default:
5046
return nil, fmt.Errorf("invalid git implementation %s", gitImplementation)
5147
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1
17+
package gogit
1818

1919
import (
2020
"context"
@@ -27,6 +27,7 @@ import (
2727
"github.com/go-git/go-git/v5/plumbing"
2828

2929
"github.com/fluxcd/pkg/version"
30+
3031
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
3132
"github.com/fluxcd/source-controller/pkg/git/common"
3233
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1
17+
package gogit
1818

1919
import (
2020
"context"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1
17+
package gogit
1818

1919
import (
2020
"fmt"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1
17+
package gogit
1818

1919
import (
2020
"fmt"
@@ -25,6 +25,7 @@ import (
2525
corev1 "k8s.io/api/core/v1"
2626

2727
"github.com/fluxcd/pkg/ssh/knownhosts"
28+
2829
"github.com/fluxcd/source-controller/pkg/git/common"
2930
)
3031

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v1
17+
package gogit
1818

1919
import (
2020
"reflect"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package libgit2
1818

1919
import (
2020
"context"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package libgit2
1818

1919
import (
2020
"context"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package libgit2
1818

1919
import (
2020
"bytes"
2121
"fmt"
22-
"golang.org/x/crypto/openpgp"
2322
"strings"
2423

24+
"golang.org/x/crypto/openpgp"
25+
2526
git2go "github.com/libgit2/git2go/v31"
2627
corev1 "k8s.io/api/core/v1"
2728
)

0 commit comments

Comments
 (0)