Skip to content

Commit 181b7c3

Browse files
authored
chore(librarian): cleanup footer value whitespace (#2526)
Fixes: #2524
1 parent e267b1d commit 181b7c3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

internal/conventionalcommits/conventional_commits.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ func parseFooters(footerLines []string) (footers map[string]string, isBreaking b
360360
isBreaking = true
361361
}
362362
}
363+
for key, value := range footers {
364+
footers[key] = strings.TrimSpace(value)
365+
}
363366
return footers, isBreaking
364367
}
365368

internal/conventionalcommits/conventional_commits_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,8 @@ func TestParseFooters(t *testing.T) {
761761
name: "multi-line footers with key on one line, value on the next",
762762
footerLines: []string{
763763
"PiperOrigin-RevId: 123456",
764-
"",
764+
"Library-IDs:",
765+
"library-one,library-two",
765766
"Source-Link:",
766767
"",
767768
"googleapis/googleapis@a12b345",
@@ -772,8 +773,10 @@ func TestParseFooters(t *testing.T) {
772773
},
773774
wantFooters: map[string]string{
774775
"PiperOrigin-RevId": "123456",
775-
"Source-Link": "\ngoogleapis/googleapis@a12b345",
776-
"Copy-Tag": "\neyJwIjoic"},
776+
"Library-IDs": "library-one,library-two",
777+
"Source-Link": "googleapis/googleapis@a12b345",
778+
"Copy-Tag": "eyJwIjoic",
779+
},
777780
},
778781
} {
779782
t.Run(test.name, func(t *testing.T) {

0 commit comments

Comments
 (0)