From 3d6ea23b2ff718162db50ffe9b05fcf45d774827 Mon Sep 17 00:00:00 2001 From: Adam Abrams Date: Wed, 22 Sep 2021 10:10:18 -0500 Subject: [PATCH] fix: only add punctuation when not already present --- change | 2 +- .../setup/CHANGELOG-template.md | 32 +++++++++++++++++++ tests/change-punctuation/setup/CHANGELOG.md | 17 ++++++++++ tests/change-punctuation/setup/exp-stderr | 0 tests/change-punctuation/setup/exp-stdout | 3 ++ tests/change-punctuation/setup/results | 9 ++++++ tests/change-punctuation/setup/run-test | 26 +++++++++++++++ .../setup/CHANGELOG-template.md | 2 +- tests/change-symbols/setup/run-test | 2 +- 9 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 tests/change-punctuation/setup/CHANGELOG-template.md create mode 100644 tests/change-punctuation/setup/CHANGELOG.md create mode 100644 tests/change-punctuation/setup/exp-stderr create mode 100644 tests/change-punctuation/setup/exp-stdout create mode 100755 tests/change-punctuation/setup/results create mode 100755 tests/change-punctuation/setup/run-test diff --git a/change b/change index 5ee9278..38057a3 100755 --- a/change +++ b/change @@ -152,7 +152,7 @@ fmt_commits() { for commit in $all_commits; do first_char=$(echo "$commit" | cut -c 1 | tr "[:lower:]" "[:upper:]") - echo "$commit" | sed -e "s|^.\(.*$\)|- $first_char\1.|" + echo "$commit" | sed -e "s|^.\(.*$\)|- $first_char\1|" -e 's|\(.*[^.!?]\)$|\1.|' done } diff --git a/tests/change-punctuation/setup/CHANGELOG-template.md b/tests/change-punctuation/setup/CHANGELOG-template.md new file mode 100644 index 0000000..87254f6 --- /dev/null +++ b/tests/change-punctuation/setup/CHANGELOG-template.md @@ -0,0 +1,32 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.2.1] - ~~SUB-DATE~~ +### Fixed +- Add fifth file. + +## [0.2.0] - ~~SUB-DATE~~ +### Added +- Add fourth file!! + +## [0.1.1] - ~~SUB-DATE~~ +### Fixed +- Add third file. + +## [0.1.0] - 2021-01-19 +### Added +- Add first file. + +### Fixed +- Add second file. + +[Unreleased]: https://github.com/adamtabrams/change/compare/0.2.1...HEAD +[0.2.1]: https://github.com/adamtabrams/change/compare/0.2.0...0.2.1 +[0.2.0]: https://github.com/adamtabrams/change/compare/0.1.1...0.2.0 +[0.1.1]: https://github.com/adamtabrams/change/compare/0.1.0...0.1.1 +[0.1.0]: https://github.com/adamtabrams/change/releases/tag/0.1.0 diff --git a/tests/change-punctuation/setup/CHANGELOG.md b/tests/change-punctuation/setup/CHANGELOG.md new file mode 100644 index 0000000..5b5b760 --- /dev/null +++ b/tests/change-punctuation/setup/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.1.0] - 2021-01-19 +### Added +- Add first file. + +### Fixed +- Add second file. + +[Unreleased]: https://github.com/adamtabrams/change/compare/0.1.0...HEAD +[0.1.0]: https://github.com/adamtabrams/change/releases/tag/0.1.0 diff --git a/tests/change-punctuation/setup/exp-stderr b/tests/change-punctuation/setup/exp-stderr new file mode 100644 index 0000000..e69de29 diff --git a/tests/change-punctuation/setup/exp-stdout b/tests/change-punctuation/setup/exp-stdout new file mode 100644 index 0000000..069ccb3 --- /dev/null +++ b/tests/change-punctuation/setup/exp-stdout @@ -0,0 +1,3 @@ +added 0.1.1 to CHANGELOG.md +added 0.2.0 to CHANGELOG.md +added 0.2.1 to CHANGELOG.md diff --git a/tests/change-punctuation/setup/results b/tests/change-punctuation/setup/results new file mode 100755 index 0000000..6c93623 --- /dev/null +++ b/tests/change-punctuation/setup/results @@ -0,0 +1,9 @@ +#!/bin/sh + +. ../../.test-resources.sh + +compare_stdout +compare_stderr + +gen_changelog_exp +compare_changelog diff --git a/tests/change-punctuation/setup/run-test b/tests/change-punctuation/setup/run-test new file mode 100755 index 0000000..8594c42 --- /dev/null +++ b/tests/change-punctuation/setup/run-test @@ -0,0 +1,26 @@ +#!/bin/sh + +git init --quiet + +git add run-test +git commit --quiet -am "feat: add first file" +git add results +git commit --quiet -am "fix: add second file" +git tag 0.1.0 + +git add exp-stderr +git commit --quiet -am "fix: add third file." +git tag 0.1.1 + +git add exp-stdout +git commit --quiet -am "feat: add fourth file!!" +git tag 0.2.0 + +git add CHANGELOG.md +git commit --quiet -am "fix: add fifth file" + +git remote add origin https://github.com/adamtabrams/change.git + +change >act-stdout 2>act-stderr + +rm -rf ./.git diff --git a/tests/change-symbols/setup/CHANGELOG-template.md b/tests/change-symbols/setup/CHANGELOG-template.md index 21bf09d..0496f8b 100644 --- a/tests/change-symbols/setup/CHANGELOG-template.md +++ b/tests/change-symbols/setup/CHANGELOG-template.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - (paren pair) {curly pair} [square pair]. - Website https://github.com/adamtabrams. - Asterisk * escaped asterisk \*. -- Four backslashes \ exclamation !. +- Exclamation ! four backslashes \. - 'apostrophe pair' `escaped tick pair`. - Tilda ~ escaped tick ` ampersand &. diff --git a/tests/change-symbols/setup/run-test b/tests/change-symbols/setup/run-test index 5ef82fe..3b586f6 100755 --- a/tests/change-symbols/setup/run-test +++ b/tests/change-symbols/setup/run-test @@ -19,7 +19,7 @@ git rm --quiet --cached exp-stderr git commit --quiet -am "chore: single backslash \ escaped backslash \\ " git add exp-stderr -git commit --quiet -am "fix: four backslashes \\\\ exclamation !" +git commit --quiet -am "fix: exclamation ! four backslashes \\\\" git rm --quiet --cached exp-stderr git commit --quiet -am 'chore: colon exclamation :! "quote pair"'