Skip to content

Commit

Permalink
Merge pull request #128 from wader/refs-test-git-branch-name
Browse files Browse the repository at this point in the history
gitrefs: Set default branch name to make test work with any git version
  • Loading branch information
wader authored Nov 24, 2023
2 parents 451f3a7 + 1cf9bf3 commit 5e992b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/gitrefs/refs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ func TestLocalRepo(t *testing.T) {
return string(b)
}

runOrFatal("git", "init", ".")
runOrFatal("git", "init", "-b", "main", ".")

actualRefs, err := gitrefs.Refs("file://"+tempDir, gitrefs.AllProtos)
if err != nil {
t.Fatal(err)
}
expectedRefs := []gitrefs.Ref{{Name: "HEAD", ObjID: "refs/heads/master"}}
expectedRefs := []gitrefs.Ref{{Name: "HEAD", ObjID: "refs/heads/main"}}
if !reflect.DeepEqual(expectedRefs, actualRefs) {
t.Errorf("expected %v got %v", expectedRefs, actualRefs)
}
Expand All @@ -54,7 +54,7 @@ func TestLocalRepo(t *testing.T) {
}
expectedRefs = []gitrefs.Ref{
{Name: "HEAD", ObjID: sha},
{Name: "refs/heads/master", ObjID: sha},
{Name: "refs/heads/main", ObjID: sha},
}
if !reflect.DeepEqual(expectedRefs, actualRefs) {
t.Errorf("expected %v got %v", expectedRefs, actualRefs)
Expand Down

0 comments on commit 5e992b4

Please sign in to comment.