@@ -53,6 +53,12 @@ func newRepository(t *testing.T) {
53
53
require .NotNil (repo .auth )
54
54
}
55
55
56
+ var gitCommitAuthor = & object.Signature {
57
+ Name : "test" ,
58
+ Email : "test@test.com" ,
59
+ When : time .Now (),
60
+ }
61
+
56
62
//gocyclo:ignore
57
63
func setupRepo () (string , error ) {
58
64
dir , err := os .MkdirTemp ("" , "provider-git" )
@@ -76,15 +82,10 @@ func setupRepo() (string, error) {
76
82
return "" , err
77
83
}
78
84
79
- author := & object.Signature {
80
- Name : "test" ,
81
- Email : "test@test.com" ,
82
- When : time .Now (),
83
- }
84
85
versionCount := 0
85
86
betaCount := 1
86
87
for i := 0 ; i < 100 ; i ++ {
87
- commit , commitErr := w .Commit (fmt .Sprintf ("feat: commit %d" , i ), & git.CommitOptions {Author : author , AllowEmptyCommits : true })
88
+ commit , commitErr := w .Commit (fmt .Sprintf ("feat: commit %d" , i ), & git.CommitOptions {Author : gitCommitAuthor , AllowEmptyCommits : true })
88
89
if commitErr != nil {
89
90
return "" , err
90
91
}
@@ -110,7 +111,7 @@ func setupRepo() (string, error) {
110
111
return "" , err
111
112
}
112
113
113
- if _ , err = w .Commit ("fix: error" , & git.CommitOptions {Author : author , AllowEmptyCommits : true }); err != nil {
114
+ if _ , err = w .Commit ("fix: error" , & git.CommitOptions {Author : gitCommitAuthor , AllowEmptyCommits : true }); err != nil {
114
115
return "" , err
115
116
}
116
117
if err = w .Checkout (& git.CheckoutOptions {Branch : plumbing .NewBranchReferenceName ("master" )}); err != nil {
@@ -169,6 +170,12 @@ func getCommits(t *testing.T) {
169
170
170
171
for _ , c := range commits {
171
172
require .True (strings .HasPrefix (c .RawMessage , "feat: commit" ))
173
+ require .Equal (gitCommitAuthor .Name , c .Annotations ["author_name" ])
174
+ require .Equal (gitCommitAuthor .Email , c .Annotations ["author_email" ])
175
+ require .Equal (gitCommitAuthor .When .Format (time .RFC3339 ), c .Annotations ["author_date" ])
176
+ require .Equal (gitCommitAuthor .When .Format (time .RFC3339 ), c .Annotations ["committer_date" ])
177
+ require .Equal (gitCommitAuthor .Name , c .Annotations ["committer_name" ])
178
+ require .Equal (gitCommitAuthor .Email , c .Annotations ["committer_email" ])
172
179
}
173
180
}
174
181
0 commit comments