From 5c3bbb4f089e874bc26e41e9f1b846b5940fbd52 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Wed, 7 Aug 2024 17:24:18 -0400 Subject: [PATCH] Generate diff link for first release And include the "v" for the version tag in the diff. --- .ci/mknotes | 12 +++++++++++- CHANGELOG.md | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.ci/mknotes b/.ci/mknotes index 76061a9..59343e5 100755 --- a/.ci/mknotes +++ b/.ci/mknotes @@ -75,6 +75,9 @@ sub run { $in_item = $self->print_line($out, $line, $in_item) unless $line =~ $link_regex; } + # Reach the end of the file; must be the first release. Diff the + # initial commit. + return $self->finish_list($out, $self->initial_commit); } } @@ -82,6 +85,13 @@ sub run { die "Version $self->{version} not found in $self->{file}\n" unless $found; } +# Called when no previous releases found. Return the initial commit in +# brackets to be parsed by finish_list(). +sub initial_commit { + my $sha = qx(git rev-list --max-parents=0 HEAD); + return "[" . substr($sha, 0, 7) . "]"; +} + # Called when the next version header is found in line. sub finish_list { my ($self, $out, $line) = @_; @@ -92,7 +102,7 @@ sub finish_list { # Emit a footer line with a link to the diff for this version. print {$out} sprintf( - "---\n\nšŸ†š For more detail compare [changes since %s](%s/compare/%s...%s).\n", + "---\n\nšŸ†š For more detail compare [changes since %s](%s/compare/%s...v%s).\n", $prev, $self->{repo}, $prev, $self->{version}, ); diff --git a/CHANGELOG.md b/CHANGELOG.md index df18423..f7599be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,7 @@ The theme of this release is *learning Rust and pgrx.* * Performance [benchmark script] * Multi-schema [composition example] - [v0.1.0]: https://github.com/tembo-io/pg-jsonschema-boon/compare/34d5d49...HEAD + [v0.1.0]: https://github.com/tembo-io/pg-jsonschema-boon/compare/34d5d49...v0.1.0 [boon]: https://github.com/santhosh-tekuri/boon [README]: https://github.com/tembo-io/pg-jsonschema-boon/blob/v0.1.0/README.md [PGXN]: https://pgxn.org/dist/jsonschema/