-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support count_tags option #599
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[changelog] | ||
# changelog header | ||
header = """ | ||
# Changelog\n | ||
All notable changes to this project will be documented in this file.\n | ||
""" | ||
# template for the changelog body | ||
# https://keats.github.io/tera/docs/#introduction | ||
body = """ | ||
{% if version %}\ | ||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} | ||
{% else %}\ | ||
## [unreleased] | ||
{% endif %}\ | ||
{% for group, commits in commits | group_by(attribute="group") %} | ||
### {{ group | upper_first }} | ||
{% for commit in commits %} | ||
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ | ||
{% endfor %} | ||
{% endfor %}\n | ||
""" | ||
# template for the changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" | ||
# remove the leading and trailing whitespace from the templates | ||
trim = true | ||
|
||
[git] | ||
# regex for skipping tags | ||
skip_tags = "v0.1.0-beta.1" | ||
# regex for ignoring tags | ||
ignore_tags = "v.*-beta.*" | ||
count_tags = "v0.2.0" | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add skip feature" | ||
git tag v0.1.0-beta.1 | ||
|
||
GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 1" | ||
GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1" | ||
git tag v0.1.0 | ||
|
||
GIT_COMMITTER_DATE="2021-01-23 01:23:48" git commit --allow-empty -m "feat: add feature 2" | ||
git tag v0.2.0-beta.1 | ||
|
||
GIT_COMMITTER_DATE="2021-01-23 01:23:49" git commit --allow-empty -m "feat: add feature 3" | ||
git tag v0.2.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
## [0.2.0] - 2021-01-23 | ||
|
||
### Feat | ||
|
||
- Add feature 1 | ||
- Fix feature 1 | ||
- Add feature 2 | ||
- Add feature 3 | ||
|
||
<!-- generated by git-cliff --> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,9 @@ pub struct GitConfig { | |
/// Regex to ignore matched tags. | ||
#[serde(with = "serde_regex", default)] | ||
pub ignore_tags: Option<Regex>, | ||
/// Regex to count matched tags. | ||
#[serde(with = "serde_regex", default)] | ||
pub count_tags: Option<Regex>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naming is hard. I name it "count" because it's if "counted". "include" may be an alternative, but .. we have two aspects here: (1) whether count the commit (2) whether count the tag. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, how we can support pass this option from command line? |
||
/// Whether to sort tags topologically. | ||
pub topo_order: Option<bool>, | ||
/// Sorting of the commits inside sections. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems barely
v0.2.0
would matchv0.2.0-beta.1
. Perhaps^v0.2.0$
would work. But this indicates a bit that condition combination can be complex and if we merge the positive and negative condition in one option, it may not be less complex.