Skip to content

Commit 434dc39

Browse files
committed
chore: Fix git tests
1 parent 6330564 commit 434dc39

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

version/git_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package version
22

33
import (
4-
"io/ioutil"
4+
"os"
55
"testing"
66
"time"
77

@@ -12,7 +12,7 @@ import (
1212

1313
func TestGitDescribe(t *testing.T) {
1414
assert := assert.New(t)
15-
dir, _ := ioutil.TempDir("", "example")
15+
dir, _ := os.MkdirTemp("", "example")
1616
repo, err := git.PlainInit(dir, false)
1717
assert.NoError(err)
1818

@@ -31,7 +31,11 @@ func TestGitDescribe(t *testing.T) {
3131
Email: "john@doe.org",
3232
When: now,
3333
}
34-
opts := git.CommitOptions{Author: author, Committer: author}
34+
opts := git.CommitOptions{
35+
Author: author,
36+
Committer: author,
37+
AllowEmptyCommits: true,
38+
}
3539

3640
commit1, err := worktree.Commit("first commit", &opts)
3741
assert.NoError(err)
@@ -93,7 +97,7 @@ func TestGitDescribe(t *testing.T) {
9397

9498
func TestGitDescribeError(t *testing.T) {
9599
assert := assert.New(t)
96-
dir, _ := ioutil.TempDir("", "example")
100+
dir, _ := os.MkdirTemp("", "example")
97101

98102
test := func(msg string) {
99103
head, err := GitDescribe(dir)

0 commit comments

Comments
 (0)