chore: refactor / docstrings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-12-21 19:22:26 +01:00
parent 0bb25a00ec
commit 3f29084664
2 changed files with 5 additions and 6 deletions

View File

@ -8,17 +8,15 @@ import (
"github.com/go-git/go-git/v5/storage/memory"
)
// Verify that SwitchToMain has the desired effect on the repo
func TestSwitchToMain(t *testing.T) {
storage := memory.NewStorage()
repo, err := git.Init(storage, nil)
repo, err := git.Init(memory.NewStorage(), nil)
if err != nil {
t.Fatalf("failed to create in-memory repository: %v", err)
}
err = SwitchToMain(repo)
if err != nil {
if err = SwitchToMain(repo); err != nil {
t.Fatalf("SwitchToMain failed: %v", err)
}
ref, err := repo.Reference(plumbing.HEAD, false)
if err != nil {
t.Fatalf("failed to get HEAD reference: %v", err)
@ -26,6 +24,7 @@ func TestSwitchToMain(t *testing.T) {
if ref.Target().String() != "refs/heads/main" {
t.Errorf("expected HEAD to point to 'refs/heads/main', got %s", ref.Target().String())
}
cfg, err := repo.Config()
if err != nil {
t.Fatalf("failed to get repository config: %v", err)