@@ -261,7 +261,7 @@ END_NESTED_COMMIT
261261 LibraryID : "example-id" ,
262262 IsNested : false ,
263263 Footers : map [string ]string {},
264- SHA : sha .String (),
264+ SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
265265 When : now ,
266266 },
267267 {
@@ -272,7 +272,7 @@ END_NESTED_COMMIT
272272 LibraryID : "example-id" ,
273273 IsNested : true ,
274274 Footers : map [string ]string {},
275- SHA : sha .String (),
275+ SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
276276 When : now ,
277277 },
278278 {
@@ -283,12 +283,11 @@ END_NESTED_COMMIT
283283 LibraryID : "example-id" ,
284284 IsNested : true ,
285285 Footers : map [string ]string {},
286- SHA : sha .String (),
286+ SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
287287 When : now ,
288288 },
289289 },
290290 },
291-
292291 {
293292 name : "commit with empty nested commit" ,
294293 message : `feat(parser): main feature
@@ -341,7 +340,6 @@ PiperOrigin-RevId: 654321
341340Source-link: fake-link
342341END_NESTED_COMMIT
343342END_COMMIT_OVERRIDE
344-
345343` ,
346344 want : []* ConventionalCommit {
347345 {
@@ -351,7 +349,7 @@ END_COMMIT_OVERRIDE
351349 LibraryID : "example-id" ,
352350 IsNested : true ,
353351 Footers : map [string ]string {"PiperOrigin-RevId" : "123456" , "Source-link" : "fake-link" },
354- SHA : sha .String (),
352+ SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
355353 When : now ,
356354 },
357355 {
@@ -361,7 +359,7 @@ END_COMMIT_OVERRIDE
361359 Body : "body of nested commit 2\n ..." ,
362360 LibraryID : "example-id" ,
363361 Footers : map [string ]string {"PiperOrigin-RevId" : "654321" , "Source-link" : "fake-link" },
364- SHA : sha .String (),
362+ SHA : sha .String (), // For each nested commit, the SHA should be the same (points to language repo's commit hash)
365363 When : now ,
366364 },
367365 },
@@ -491,14 +489,14 @@ func TestConventionalCommit_MarshalJSON(t *testing.T) {
491489 Body : "body of feature" ,
492490 Footers : map [string ]string {
493491 "PiperOrigin-RevId" : "12345" ,
494- "git-commit-hash" : "abcdef123456" ,
495492 },
493+ SHA : "1234" ,
496494 }
497495 b , err := c .MarshalJSON ()
498496 if err != nil {
499497 t .Fatalf ("MarshalJSON() failed: %v" , err )
500498 }
501- want := `{"type":"feat","subject":"new feature","body":"body of feature","piper_cl_number ":"12345 ","source_commit_hash ":"abcdef123456 "}`
499+ want := `{"type":"feat","subject":"new feature","body":"body of feature","source_commit_hash ":"1234 ","piper_cl_number ":"12345 "}`
502500 if diff := cmp .Diff (want , string (b )); diff != "" {
503501 t .Errorf ("MarshalJSON() mismatch (-want +got):\n %s" , diff )
504502 }
0 commit comments