Provisioning: Bump nanogit library for performance improvemnents (#107026)

* Bump nanogit library

This version of nanogit will be optimized for performance, specially for
bulk writes. It will store packfiles in a temporary file if there are
too many and clean up after push or when the writer is removed.

* Format code in nanogit/git.go
This commit is contained in:
Roberto Jiménez Sánchez
2025-06-20 12:51:29 +02:00
committed by GitHub
parent b30f501bff
commit d1b4bb182d
6 changed files with 21 additions and 13 deletions
@@ -161,7 +161,8 @@ func (r *gitRepository) Test(ctx context.Context) (*provisioning.TestResults, er
Type: metav1.CauseTypeFieldValueInvalid,
Field: field.NewPath("spec", t, "token").String(),
Detail: detail,
}}}, nil
}},
}, nil
}
if ok, err := r.client.RepoExists(ctx); err != nil || !ok {
@@ -177,7 +178,8 @@ func (r *gitRepository) Test(ctx context.Context) (*provisioning.TestResults, er
Type: metav1.CauseTypeFieldValueInvalid,
Field: field.NewPath("spec", t, "url").String(),
Detail: detail,
}}}, nil
}},
}, nil
}
// Test basic connectivity by getting the branch reference
@@ -192,7 +194,8 @@ func (r *gitRepository) Test(ctx context.Context) (*provisioning.TestResults, er
Type: metav1.CauseTypeFieldValueInvalid,
Field: field.NewPath("spec", t, "branch").String(),
Detail: detail,
}}}, nil
}},
}, nil
}
detail = fmt.Sprintf("failed to check if branch exists: %v", err)
@@ -204,7 +207,8 @@ func (r *gitRepository) Test(ctx context.Context) (*provisioning.TestResults, er
Type: metav1.CauseTypeFieldValueInvalid,
Field: field.NewPath("spec", t, "branch").String(),
Detail: detail,
}}}, nil
}},
}, nil
}
return &provisioning.TestResults{
@@ -186,8 +186,6 @@ func (r *stagedGitRepository) Push(ctx context.Context, opts repository.PushOpti
return r.writer.Push(ctx)
}
func (r *stagedGitRepository) Remove(_ context.Context) error {
// Since we're using nanogit which doesn't actually clone the repository,
// we don't need to do anything here as there's nothing to clean up
return nil
func (r *stagedGitRepository) Remove(ctx context.Context) error {
return r.writer.Cleanup(ctx)
}
@@ -895,9 +895,8 @@ func TestStagedGitRepository_Remove(t *testing.T) {
stagedRepo := createTestStagedRepositoryWithWriter(mockWriter, repository.CloneOptions{})
err := stagedRepo.Remove(context.Background())
require.NoError(t, err)
// No mock calls expected since Remove is a no-op
require.Equal(t, 1, mockWriter.CleanupCallCount())
})
}