@@ -53,6 +53,12 @@ func newRepository(t *testing.T) {
5353 require .NotNil (repo .auth )
5454}
5555
56+ var gitCommitAuthor = & object.Signature {
57+ Name : "test" ,
58+ Email : "test@test.com" ,
59+ When : time .Now (),
60+ }
61+
5662//gocyclo:ignore
5763func setupRepo () (string , error ) {
5864 dir , err := os .MkdirTemp ("" , "provider-git" )
@@ -76,15 +82,10 @@ func setupRepo() (string, error) {
7682 return "" , err
7783 }
7884
79- author := & object.Signature {
80- Name : "test" ,
81- Email : "test@test.com" ,
82- When : time .Now (),
83- }
8485 versionCount := 0
8586 betaCount := 1
8687 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 })
8889 if commitErr != nil {
8990 return "" , err
9091 }
@@ -110,7 +111,7 @@ func setupRepo() (string, error) {
110111 return "" , err
111112 }
112113
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 {
114115 return "" , err
115116 }
116117 if err = w .Checkout (& git.CheckoutOptions {Branch : plumbing .NewBranchReferenceName ("master" )}); err != nil {
@@ -169,6 +170,12 @@ func getCommits(t *testing.T) {
169170
170171 for _ , c := range commits {
171172 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" ])
172179 }
173180}
174181
0 commit comments