Rename git2go option to libgit2

Signed-off-by: Philip Laine <philip.laine@xenit.se>
This commit is contained in:
Philip Laine 2020-12-06 23:19:53 +01:00
parent 1b4eacc588
commit f044ebc253
6 changed files with 15 additions and 15 deletions

View File

@ -29,7 +29,7 @@ const (
// Represents the go-git git implementation kind // Represents the go-git git implementation kind
GoGitImplementation = "go-git" GoGitImplementation = "go-git"
// Represents the gi2go git implementation kind // Represents the gi2go git implementation kind
Git2GoImplementation = "git2go" LibGit2Implementation = "libgit2"
) )
// GitRepositorySpec defines the desired state of a Git repository. // GitRepositorySpec defines the desired state of a Git repository.
@ -76,8 +76,8 @@ type GitRepositorySpec struct {
Suspend bool `json:"suspend,omitempty"` Suspend bool `json:"suspend,omitempty"`
// Determines which git client library to use. // Determines which git client library to use.
// Defaults to go-git, valid values are ('go-git', 'git2go'). // Defaults to go-git, valid values are ('go-git', 'libgit2').
// +kubebuilder:validation:Enum=go-git;git2go // +kubebuilder:validation:Enum=go-git;libgit2
// +kubebuilder:default:=go-git // +kubebuilder:default:=go-git
// +optional // +optional
GitImplementation string `json:"gitImplementation,omitempty"` GitImplementation string `json:"gitImplementation,omitempty"`

View File

@ -52,10 +52,10 @@ spec:
gitImplementation: gitImplementation:
default: go-git default: go-git
description: Determines which git client library to use. Defaults description: Determines which git client library to use. Defaults
to go-git, valid values are ('go-git', 'git2go'). to go-git, valid values are ('go-git', 'libgit2').
enum: enum:
- go-git - go-git
- git2go - libgit2
type: string type: string
ignore: ignore:
description: Ignore overrides the set of excluded patterns in the description: Ignore overrides the set of excluded patterns in the

View File

@ -321,7 +321,7 @@ var _ = Describe("GitRepositoryReconciler", func() {
waitForReason: sourcev1.GitOperationFailedReason, waitForReason: sourcev1.GitOperationFailedReason,
expectStatus: metav1.ConditionFalse, expectStatus: metav1.ConditionFalse,
expectMessage: "error: user rejected certificate", expectMessage: "error: user rejected certificate",
gitImplementation: sourcev1.Git2GoImplementation, gitImplementation: sourcev1.LibGit2Implementation,
}), }),
) )
}) })

View File

@ -397,7 +397,7 @@ string
<td> <td>
<em>(Optional)</em> <em>(Optional)</em>
<p>Determines which git client library to use. <p>Determines which git client library to use.
Defaults to go-git, valid values are (&lsquo;go-git&rsquo;, &lsquo;git2go&rsquo;).</p> Defaults to go-git, valid values are (&lsquo;go-git&rsquo;, &lsquo;libgit2&rsquo;).</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -1243,7 +1243,7 @@ string
<td> <td>
<em>(Optional)</em> <em>(Optional)</em>
<p>Determines which git client library to use. <p>Determines which git client library to use.
Defaults to go-git, valid values are (&lsquo;go-git&rsquo;, &lsquo;git2go&rsquo;).</p> Defaults to go-git, valid values are (&lsquo;go-git&rsquo;, &lsquo;libgit2&rsquo;).</p>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -52,8 +52,8 @@ type GitRepositorySpec struct {
Suspend bool `json:"suspend,omitempty"` Suspend bool `json:"suspend,omitempty"`
// Determines which git client library to use. // Determines which git client library to use.
// Defaults to go-git, valid values are ('go-git', 'git2go'). // Defaults to go-git, valid values are ('go-git', 'libgit2').
// +kubebuilder:validation:Enum=go-git;git2go // +kubebuilder:validation:Enum=go-git;libgit2
// +kubebuilder:default:=go-git // +kubebuilder:default:=go-git
// +optional // +optional
GitImplementation string `json:"gitImplementation,omitempty"` GitImplementation string `json:"gitImplementation,omitempty"`
@ -194,10 +194,10 @@ and also impact the traffic costs.
To be able to support Azure DevOps a compromise solution was built, giving the user the To be able to support Azure DevOps a compromise solution was built, giving the user the
option to select the git library while accepting the drawbacks. option to select the git library while accepting the drawbacks.
| Git Implementation | Shallow Clones | Azure DevOps Support | | Git Implementation | Shallow Clones | V2 Protocol Support |
|---|---|---| |---|---|---|
| 'go-git' | true | false | | 'go-git' | true | false |
| 'git2go' | false | true | | 'libgit2' | false | true |
Pull the master branch from a repository in Azure DevOps. Pull the master branch from a repository in Azure DevOps.
@ -210,7 +210,7 @@ metadata:
spec: spec:
interval: 1m interval: 1m
url: https://dev.azure.com/org/proj/_git/repo url: https://dev.azure.com/org/proj/_git/repo
gitImplementation: git2go gitImplementation: libgit2
``` ```
## Spec examples ## Spec examples

View File

@ -33,7 +33,7 @@ func CheckoutStrategyForRef(ref *sourcev1.GitRepositoryRef, gitImplementation st
switch gitImplementation { switch gitImplementation {
case sourcev1.GoGitImplementation: case sourcev1.GoGitImplementation:
return gitv1.CheckoutStrategyForRef(ref), nil return gitv1.CheckoutStrategyForRef(ref), nil
case sourcev1.Git2GoImplementation: case sourcev1.LibGit2Implementation:
return gitv2.CheckoutStrategyForRef(ref), nil return gitv2.CheckoutStrategyForRef(ref), nil
default: default:
return nil, fmt.Errorf("invalid git implementation %s", gitImplementation) return nil, fmt.Errorf("invalid git implementation %s", gitImplementation)
@ -44,7 +44,7 @@ func AuthSecretStrategyForURL(url string, gitImplementation string) (common.Auth
switch gitImplementation { switch gitImplementation {
case sourcev1.GoGitImplementation: case sourcev1.GoGitImplementation:
return gitv1.AuthSecretStrategyForURL(url) return gitv1.AuthSecretStrategyForURL(url)
case sourcev1.Git2GoImplementation: case sourcev1.LibGit2Implementation:
return gitv2.AuthSecretStrategyForURL(url) return gitv2.AuthSecretStrategyForURL(url)
default: default:
return nil, fmt.Errorf("invalid git implementation %s", gitImplementation) return nil, fmt.Errorf("invalid git implementation %s", gitImplementation)