Merge pull request #1145 from fluxcd/bump-gogit

Update go-git to unreleased v5.8.0
This commit is contained in:
Hidde Beydals 2023-07-03 12:37:12 +02:00 committed by GitHub
commit 93a6231c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 58 deletions

3
go.mod
View File

@ -14,6 +14,9 @@ replace github.com/opencontainers/go-digest => github.com/opencontainers/go-dige
// Check again when oras.land/oras-go is updated, which is a dependency of Helm. // Check again when oras.land/oras-go is updated, which is a dependency of Helm.
replace github.com/docker/docker => github.com/docker/docker v23.0.6+incompatible replace github.com/docker/docker => github.com/docker/docker v23.0.6+incompatible
// Replace go-git to unreleased v5.8.0 to improve support for Git v2.41+.
replace github.com/go-git/go-git/v5 => github.com/go-git/go-git/v5 v5.7.1-0.20230702134234-dd4e2b7f4b01
require ( require (
cloud.google.com/go/storage v1.30.1 cloud.google.com/go/storage v1.30.1
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1

4
go.sum
View File

@ -437,8 +437,8 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS
github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4= github.com/go-git/go-billy/v5 v5.4.1 h1:Uwp5tDRkPr+l/TnbHOQzp+tmJfLceOlbVucgpTz8ix4=
github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg= github.com/go-git/go-billy/v5 v5.4.1/go.mod h1:vjbugF6Fz7JIflbVpl1hJsGjSHNltrSw45YK/ukIvQg=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20230305113008-0c11038e723f h1:Pz0DHeFij3XFhoBRGUDPzSJ+w2UcK5/0JvF8DRI58r8=
github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE= github.com/go-git/go-git/v5 v5.7.1-0.20230702134234-dd4e2b7f4b01 h1:+yTyIn80JO1XGuLjgnUwnJDFpRw5dOVk6Yv5dAzi5dI=
github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= github.com/go-git/go-git/v5 v5.7.1-0.20230702134234-dd4e2b7f4b01/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=

View File

@ -219,62 +219,57 @@ func TestGitRepositoryReconciler_Reconcile(t *testing.T) {
testSuspendedObjectDeleteWithArtifact(ctx, g, obj) testSuspendedObjectDeleteWithArtifact(ctx, g, obj)
} }
// TODO(hidde): Re-enable this test. func TestGitRepositoryReconciler_reconcileSource_emptyRepository(t *testing.T) {
// It is currently disabled because it fails on machines with Git version g := NewWithT(t)
// >=v2.41.0 due to changes to commands used by the test server. Causing
// the test server to return an error when cloning an empty repository, server, err := gittestserver.NewTempGitServer()
// instead of yielding an empty object. g.Expect(err).NotTo(HaveOccurred())
//func TestGitRepositoryReconciler_reconcileSource_emptyRepository(t *testing.T) { defer os.RemoveAll(server.Root())
// g := NewWithT(t) server.AutoCreate()
// g.Expect(server.StartHTTP()).To(Succeed())
// server, err := gittestserver.NewTempGitServer() defer server.StopHTTP()
// g.Expect(err).NotTo(HaveOccurred())
// defer os.RemoveAll(server.Root()) obj := &sourcev1.GitRepository{
// server.AutoCreate() ObjectMeta: metav1.ObjectMeta{
// g.Expect(server.StartHTTP()).To(Succeed()) GenerateName: "empty-",
// defer server.StopHTTP() Generation: 1,
// },
// obj := &sourcev1.GitRepository{ Spec: sourcev1.GitRepositorySpec{
// ObjectMeta: metav1.ObjectMeta{ Interval: metav1.Duration{Duration: interval},
// GenerateName: "empty-", Timeout: &metav1.Duration{Duration: timeout},
// Generation: 1, URL: server.HTTPAddress() + "/test.git",
// }, },
// Spec: sourcev1.GitRepositorySpec{ }
// Interval: metav1.Duration{Duration: interval},
// Timeout: &metav1.Duration{Duration: timeout}, clientBuilder := fakeclient.NewClientBuilder().
// URL: server.HTTPAddress() + "/test.git", WithScheme(testEnv.GetScheme()).
// }, WithStatusSubresource(&sourcev1.GitRepository{})
// }
// r := &GitRepositoryReconciler{
// clientBuilder := fakeclient.NewClientBuilder(). Client: clientBuilder.Build(),
// WithScheme(testEnv.GetScheme()). EventRecorder: record.NewFakeRecorder(32),
// WithStatusSubresource(&sourcev1.GitRepository{}) Storage: testStorage,
// patchOptions: getPatchOptions(gitRepositoryReadyCondition.Owned, "sc"),
// r := &GitRepositoryReconciler{ }
// Client: clientBuilder.Build(),
// EventRecorder: record.NewFakeRecorder(32), g.Expect(r.Client.Create(context.TODO(), obj)).ToNot(HaveOccurred())
// Storage: testStorage, defer func() {
// patchOptions: getPatchOptions(gitRepositoryReadyCondition.Owned, "sc"), g.Expect(r.Client.Delete(context.TODO(), obj)).ToNot(HaveOccurred())
// } }()
//
// g.Expect(r.Client.Create(context.TODO(), obj)).ToNot(HaveOccurred()) var commit git.Commit
// defer func() { var includes artifactSet
// g.Expect(r.Client.Delete(context.TODO(), obj)).ToNot(HaveOccurred()) sp := patch.NewSerialPatcher(obj, r.Client)
// }()
// got, err := r.reconcileSource(context.TODO(), sp, obj, &commit, &includes, t.TempDir())
// var commit git.Commit assertConditions := []metav1.Condition{
// var includes artifactSet *conditions.TrueCondition(sourcev1.FetchFailedCondition, "EmptyGitRepository", "git repository is empty"),
// sp := patch.NewSerialPatcher(obj, r.Client) }
// g.Expect(obj.Status.Conditions).To(conditions.MatchConditions(assertConditions))
// got, err := r.reconcileSource(context.TODO(), sp, obj, &commit, &includes, t.TempDir()) g.Expect(err).To(HaveOccurred())
// assertConditions := []metav1.Condition{ g.Expect(got).To(Equal(sreconcile.ResultEmpty))
// *conditions.TrueCondition(sourcev1.FetchFailedCondition, "EmptyGitRepository", "git repository is empty"), g.Expect(commit).ToNot(BeNil())
// } }
// g.Expect(obj.Status.Conditions).To(conditions.MatchConditions(assertConditions))
// g.Expect(err).To(HaveOccurred())
// g.Expect(got).To(Equal(sreconcile.ResultEmpty))
// g.Expect(commit).ToNot(BeNil())
//}
func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) { func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) {
type options struct { type options struct {