auto-changelog
auto-changelog copied to clipboard
--starting-date & --unreleased includes commits from before starting-date
Running the -u
option together with --starting-date
results in contradictory output because the --starting-date
affects the date of tags and not individual commits: https://github.com/cookpete/auto-changelog/blob/5d914d4c58b52e12ad4679b3f16e984fcb64e02d/src/tags.js#L44 A commit that is not part of a previous release, but was made before starting-date will still show up in the output.
Use case
A repository previously not using auto-changelog where commits didn't adhere to a convention and cannot be filtered out using --ignore-commit-pattern
(because there is no pattern).
Proposal
- Quick fix: Explicitly make clear in the docs that
--starting-date
looks at a tag date, not individual commit dates - Better fix: Pass the startingDate filter to
commits.js
and filter oncommit.date
instead - Maybe even better (but breaking) fix that would merge multiple args into
--ignore-commits
, which would be written as:
--ignore-commits "subject:^(dev|chore)"
--ignore-commits "date<2021-12-01"
Condition parsing can be outsourced to eg https://www.npmjs.com/package/conscript or can be limited to the format <prop><operator><value>
, with just a few operators (><=!:
with :
meaning regex), eg to build a changelog with only 1 contributor's commits you'd do: author!<name>
.
Total agree!
@webketje Would this be considered breaking if we're adding another parameter --ignore-commits? I wouldn't mind helping with this as I'm looking to create a list of merged issues in my Changelog.
@ollypolly I believe this requirement does not justify adding yet another option (not to mention passing specific commits would be unwieldy, only a range would do). In the discussion at https://github.com/cookpete/auto-changelog/issues/228 I mentioned
I think the reason why a lot of these option feature requests exist, is because the --append-git-log and --append-git-tag options are not self-evident
I think (untested) most of the desired results can be achieved using auto-changelog --append-git-log "--since=2022-01-01"
or any of the commit-limiting options documented in the Git SCM docs.
But the best solution is to do the date filtering on commits and not on tags