Skip to content

Commit

Permalink
Fix setting start-rev in krel changelog
Browse files Browse the repository at this point in the history
It's not possible to omit the start revision in krel changelog so we
have to add them to the notes options.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
  • Loading branch information
saschagrunert committed May 11, 2020
1 parent b5c2fb5 commit 8d635b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/krel/cmd/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ func generateReleaseNotes(opts *changelogOptions, branch, startRev, endRev strin

notesOptions := options.New()
notesOptions.Branch = branch
notesOptions.StartRev = startRev
notesOptions.EndSHA = endRev
notesOptions.RepoPath = rootOpts.repoPath
notesOptions.ReleaseBucket = opts.bucket
Expand All @@ -324,7 +325,7 @@ func generateReleaseNotes(opts *changelogOptions, branch, startRev, endRev strin
notesOptions.Pull = false

if err := notesOptions.ValidateAndFinish(); err != nil {
return "", err
return "", errors.Wrap(err, "validating notes options")
}

gatherer, err := notes.NewGatherer(context.Background(), notesOptions)
Expand Down
4 changes: 2 additions & 2 deletions pkg/notes/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ func (o *Options) ValidateAndFinish() (err error) {
if o.StartRev != "" && o.StartSHA == "" {
sha, err := repo.RevParse(o.StartRev)
if err != nil {
return err
return errors.Wrapf(err, "resolving %s", o.StartRev)
}
logrus.Infof("using found start SHA: %s", sha)
o.StartSHA = sha
}
if o.EndRev != "" && o.EndSHA == "" {
sha, err := repo.RevParse(o.EndRev)
if err != nil {
return err
return errors.Wrapf(err, "resolving %s", o.EndRev)
}
logrus.Infof("using found end SHA: %s", sha)
o.EndSHA = sha
Expand Down

0 comments on commit 8d635b9

Please sign in to comment.