@@ -44,7 +44,6 @@ func TestParseCommits(t *testing.T) {
4444 LibraryID : "example-id" ,
4545 IsNested : false ,
4646 Footers : make (map [string ]string ),
47- SHA : sha .String (),
4847 CommitHash : sha .String (),
4948 When : now ,
5049 },
@@ -56,12 +55,10 @@ func TestParseCommits(t *testing.T) {
5655 want : []* ConventionalCommit {
5756 {
5857 Type : "feat" ,
59- Scope : "scope" ,
6058 Subject : "add new feature" ,
6159 LibraryID : "example-id" ,
6260 IsNested : false ,
6361 Footers : make (map [string ]string ),
64- SHA : sha .String (),
6562 CommitHash : sha .String (),
6663 When : now ,
6764 },
@@ -78,7 +75,6 @@ func TestParseCommits(t *testing.T) {
7875 IsBreaking : true ,
7976 IsNested : false ,
8077 Footers : make (map [string ]string ),
81- SHA : sha .String (),
8278 CommitHash : sha .String (),
8379 When : now ,
8480 },
@@ -94,7 +90,6 @@ func TestParseCommits(t *testing.T) {
9490 LibraryID : "example-id" ,
9591 IsNested : false ,
9692 Footers :
map [
string ]
string {
"Co-authored-by" :
"John Doe <[email protected] >" },
97- SHA : sha .String (),
9893 CommitHash : sha .String (),
9994 When : now ,
10095 },
@@ -113,7 +108,6 @@ func TestParseCommits(t *testing.T) {
113108 "Co-authored-by" :
"John Doe <[email protected] >" ,
114109 "Reviewed-by" :
"Jane Smith <[email protected] >" ,
115110 },
116- SHA : sha .String (),
117111 CommitHash : sha .String (),
118112 When : now ,
119113 },
@@ -134,7 +128,6 @@ func TestParseCommits(t *testing.T) {
134128 "PiperOrigin-RevId" : "piper_cl_number" ,
135129 "Source-Link" : "abcdefg1234567" ,
136130 },
137- SHA : sha .String (),
138131 CommitHash : sha .String (),
139132 When : now ,
140133 },
@@ -152,7 +145,6 @@ func TestParseCommits(t *testing.T) {
152145 IsNested : false ,
153146 IsBreaking : true ,
154147 Footers : map [string ]string {"BREAKING CHANGE" : "this is a breaking change" },
155- SHA : sha .String (),
156148 CommitHash : sha .String (),
157149 When : now ,
158150 },
@@ -170,7 +162,6 @@ func TestParseCommits(t *testing.T) {
170162 IsNested : false ,
171163 IsBreaking : false ,
172164 Footers : map [string ]string {},
173- SHA : sha .String (),
174165 CommitHash : sha .String (),
175166 When : now ,
176167 },
@@ -187,7 +178,6 @@ func TestParseCommits(t *testing.T) {
187178 LibraryID : "example-id" ,
188179 IsNested : false ,
189180 Footers :
map [
string ]
string {
"Co-authored-by" :
"John Doe <[email protected] >" },
190- SHA : sha .String (),
191181 CommitHash : sha .String (),
192182 When : now ,
193183 },
@@ -205,7 +195,6 @@ func TestParseCommits(t *testing.T) {
205195 IsNested : false ,
206196 IsBreaking : true ,
207197 Footers : map [string ]string {"BREAKING CHANGE" : "this is a breaking change\n that spans multiple lines." },
208- SHA : sha .String (),
209198 CommitHash : sha .String (),
210199 When : now ,
211200 },
@@ -225,13 +214,11 @@ END_COMMIT_OVERRIDE`,
225214 want : []* ConventionalCommit {
226215 {
227216 Type : "fix" ,
228- Scope : "override" ,
229217 Subject : "this is the override message" ,
230218 Body : "This is the body of the override." ,
231219 LibraryID : "example-id" ,
232220 IsNested : false ,
233221 Footers : map [string ]string {"Reviewed-by" : "Jane Doe" },
234- SHA : sha .String (),
235222 CommitHash : sha .String (),
236223 When : now ,
237224 },
@@ -267,37 +254,31 @@ END_NESTED_COMMIT
267254 want : []* ConventionalCommit {
268255 {
269256 Type : "feat" ,
270- Scope : "parser" ,
271257 Subject : "main feature" ,
272258 Body : "main commit body" ,
273259 LibraryID : "example-id" ,
274260 IsNested : false ,
275261 Footers : map [string ]string {},
276- SHA : sha .String (),
277262 CommitHash : sha .String (),
278263 When : now ,
279264 },
280265 {
281266 Type : "fix" ,
282- Scope : "sub" ,
283267 Subject : "fix a bug" ,
284268 Body : "some details for the fix" ,
285269 LibraryID : "example-id" ,
286270 IsNested : true ,
287271 Footers : map [string ]string {},
288- SHA : sha .String (),
289272 CommitHash : sha .String (),
290273 When : now ,
291274 },
292275 {
293276 Type : "chore" ,
294- Scope : "deps" ,
295277 Subject : "update deps" ,
296278 Body : "" ,
297279 LibraryID : "example-id" ,
298280 IsNested : true ,
299281 Footers : map [string ]string {},
300- SHA : sha .String (),
301282 CommitHash : sha .String (),
302283 When : now ,
303284 },
@@ -314,12 +295,10 @@ END_NESTED_COMMIT
314295 want : []* ConventionalCommit {
315296 {
316297 Type : "feat" ,
317- Scope : "parser" ,
318298 Subject : "main feature 2nd line of title" ,
319299 LibraryID : "example-id" ,
320300 IsNested : false ,
321301 Footers : map [string ]string {},
322- SHA : sha .String (),
323302 CommitHash : sha .String (),
324303 When : now ,
325304 },
@@ -366,7 +345,6 @@ END_COMMIT_OVERRIDE
366345 LibraryID : "abc" ,
367346 IsNested : true ,
368347 Footers : map [string ]string {"PiperOrigin-RevId" : "123456" , "Source-Link" : "fake-link" },
369- SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
370348 CommitHash : sha .String (),
371349 When : now ,
372350 },
@@ -377,7 +355,6 @@ END_COMMIT_OVERRIDE
377355 Body : "body of nested commit 2\n ..." ,
378356 LibraryID : "abc" ,
379357 Footers : map [string ]string {"PiperOrigin-RevId" : "654321" , "Source-Link" : "fake-link" },
380- SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
381358 CommitHash : sha .String (),
382359 When : now ,
383360 },
@@ -400,13 +377,11 @@ END_NESTED_COMMIT`,
400377 want : []* ConventionalCommit {
401378 {
402379 Type : "fix" ,
403- Scope : "override" ,
404380 Subject : "this is the override message" ,
405381 Body : "This is the body of the override." ,
406382 LibraryID : "example-id" ,
407383 IsNested : false ,
408384 Footers : map [string ]string {"Reviewed-by" : "Jane Doe" },
409- SHA : sha .String (),
410385 CommitHash : sha .String (),
411386 When : now ,
412387 },
@@ -444,7 +419,6 @@ END_COMMIT_OVERRIDE`,
444419 "PiperOrigin-RevId" : "799242210" ,
445420 "Source-Link" : "b738e78ed63effb7d199ed2d61c9e03291b6077f" ,
446421 },
447- SHA : sha .String (),
448422 CommitHash : sha .String (),
449423 When : now ,
450424 },
@@ -457,7 +431,6 @@ END_COMMIT_OVERRIDE`,
457431 "PiperOrigin-RevId" : "799242210" ,
458432 "Source-Link" : "b738e78ed63effb7d199ed2d61c9e03291b6077f" ,
459433 },
460- SHA : sha .String (),
461434 CommitHash : sha .String (),
462435 When : now ,
463436 },
@@ -470,7 +443,6 @@ END_COMMIT_OVERRIDE`,
470443 "PiperOrigin-RevId" : "799242210" ,
471444 "Source-Link" : "b738e78ed63effb7d199ed2d61c9e03291b6077f" ,
472445 },
473- SHA : sha .String (),
474446 CommitHash : sha .String (),
475447 When : now ,
476448 },
@@ -504,7 +476,6 @@ END_COMMIT_OVERRIDE`,
504476 LibraryID : "texttospeech" ,
505477 IsNested : true ,
506478 Footers : map [string ]string {},
507- SHA : sha .String (),
508479 CommitHash : sha .String (),
509480 When : now ,
510481 },
@@ -514,7 +485,6 @@ END_COMMIT_OVERRIDE`,
514485 LibraryID : "texttospeech" ,
515486 IsNested : true ,
516487 Footers : map [string ]string {},
517- SHA : sha .String (),
518488 CommitHash : sha .String (),
519489 When : now ,
520490 },
@@ -524,7 +494,6 @@ END_COMMIT_OVERRIDE`,
524494 LibraryID : "texttospeech" ,
525495 IsNested : true ,
526496 Footers : map [string ]string {},
527- SHA : sha .String (),
528497 CommitHash : sha .String (),
529498 When : now ,
530499 },
@@ -561,7 +530,6 @@ END_COMMIT_OVERRIDE`,
561530 LibraryID : "google-cloud-video-live-stream" ,
562531 IsNested : true ,
563532 Footers : map [string ]string {},
564- SHA : sha .String (),
565533 CommitHash : sha .String (),
566534 When : now ,
567535 },
@@ -571,7 +539,6 @@ END_COMMIT_OVERRIDE`,
571539 LibraryID : "google-cloud-eventarc" ,
572540 IsNested : true ,
573541 Footers : map [string ]string {},
574- SHA : sha .String (),
575542 CommitHash : sha .String (),
576543 When : now ,
577544 },
@@ -681,14 +648,13 @@ func TestConventionalCommit_MarshalJSON(t *testing.T) {
681648 Footers : map [string ]string {
682649 "PiperOrigin-RevId" : "12345" ,
683650 },
684- SHA : "1234" ,
685651 CommitHash : "1234" ,
686652 }
687653 b , err := c .MarshalJSON ()
688654 if err != nil {
689655 t .Fatalf ("MarshalJSON() failed: %v" , err )
690656 }
691- want := `{"type":"feat","subject":"new feature","body":"body of feature","source_commit_hash":"1234"," commit_hash":"1234","piper_cl_number":"12345"}`
657+ want := `{"type":"feat","subject":"new feature","body":"body of feature","commit_hash":"1234","piper_cl_number":"12345"}`
692658 if diff := cmp .Diff (want , string (b )); diff != "" {
693659 t .Errorf ("MarshalJSON() mismatch (-want +got):\n %s" , diff )
694660 }
0 commit comments