@@ -2,7 +2,7 @@ package provider
2
2
3
3
import (
4
4
"fmt"
5
- "io/ioutil "
5
+ "os "
6
6
"strings"
7
7
"testing"
8
8
"time"
@@ -53,8 +53,9 @@ func newRepository(t *testing.T) {
53
53
require .NotNil (repo .auth )
54
54
}
55
55
56
+ //gocyclo:ignore
56
57
func setupRepo () (string , error ) {
57
- dir , err := ioutil . TempDir ("" , "provider-git" )
58
+ dir , err := os . MkdirTemp ("" , "provider-git" )
58
59
if err != nil {
59
60
return "" , err
60
61
}
@@ -83,19 +84,19 @@ func setupRepo() (string, error) {
83
84
versionCount := 0
84
85
betaCount := 1
85
86
for i := 0 ; i < 100 ; i ++ {
86
- commit , err := w .Commit (fmt .Sprintf ("feat: commit %d" , i ), & git.CommitOptions {Author : author })
87
- if err != nil {
87
+ commit , commitErr := w .Commit (fmt .Sprintf ("feat: commit %d" , i ), & git.CommitOptions {Author : author , AllowEmptyCommits : true })
88
+ if commitErr != nil {
88
89
return "" , err
89
90
}
90
91
if i % 10 == 0 {
91
- if _ , err := repo .CreateTag (fmt .Sprintf ("v1.%d.0" , versionCount ), commit , nil ); err != nil {
92
- return "" , err
92
+ if _ , tagErr := repo .CreateTag (fmt .Sprintf ("v1.%d.0" , versionCount ), commit , nil ); tagErr != nil {
93
+ return "" , tagErr
93
94
}
94
95
versionCount ++
95
96
}
96
97
if i % 5 == 0 {
97
- if _ , err := repo .CreateTag (fmt .Sprintf ("v2.0.0-beta.%d" , betaCount ), commit , nil ); err != nil {
98
- return "" , err
98
+ if _ , tagErr := repo .CreateTag (fmt .Sprintf ("v2.0.0-beta.%d" , betaCount ), commit , nil ); tagErr != nil {
99
+ return "" , tagErr
99
100
}
100
101
betaCount ++
101
102
}
@@ -109,7 +110,7 @@ func setupRepo() (string, error) {
109
110
return "" , err
110
111
}
111
112
112
- if _ , err = w .Commit ("fix: error" , & git.CommitOptions {Author : author }); err != nil {
113
+ if _ , err = w .Commit ("fix: error" , & git.CommitOptions {Author : author , AllowEmptyCommits : true }); err != nil {
113
114
return "" , err
114
115
}
115
116
if err = w .Checkout (& git.CheckoutOptions {Branch : plumbing .NewBranchReferenceName ("master" )}); err != nil {
0 commit comments