Skip to content

Commit bfefe70

Browse files
authored
wolfictl bump - drop all epoch-line comments . (#1935)
The vast majority of comments alongside an epoch bump are redundant with 'git log --oneline' or at very least are not relevant after the next epoch bump.
1 parent d9e3d12 commit bfefe70

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

pkg/cli/bump.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,10 @@ func bumpEpoch(ctx context.Context, opts bumpOptions, path string) error {
118118
old := fmt.Sprintf(epochPattern, cfg.Package.Epoch)
119119
for scanner.Scan() {
120120
line := scanner.Text()
121-
nocomment, comment, _ := strings.Cut(line, "#")
121+
nocomment, _, _ := strings.Cut(line, "#")
122122
if strings.TrimSpace(nocomment) == old {
123123
found = true
124-
comment = strings.TrimSpace(comment)
125-
if strings.HasPrefix(comment, "CVE-") || strings.HasPrefix(comment, "GHSA-") {
126-
line = strings.TrimRight(nocomment, " ")
127-
}
124+
line = strings.TrimRight(nocomment, " ")
128125
newFile = append(
129126
newFile, strings.ReplaceAll(line, old, fmt.Sprintf(epochPattern, cfg.Package.Epoch+1)),
130127
)

pkg/cli/bump_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TestBumpWithComment(t *testing.T) {
2626
}{
2727
{
2828
testPkgDefinition("1 # a comment!"),
29-
testPkgDefinition("2 # a comment!"),
29+
testPkgDefinition("2"),
3030
},
3131
{
3232
testPkgDefinition("1 # CVE-111-222"),

0 commit comments

Comments
 (0)