1
1
mirror of https://github.com/orhun/git-cliff.git synced 2025-01-06 02:03:09 +03:00
git-cliff/.github/fixtures
Eliza Weisman 0bf499ec94
feat(commit)!: pass footer token and separator to template (#97)
* fix(commit): pass footer token and separator to template

Currently, when a conventional commit has footers, only the footers'
values (the part after the separator token, such as `:`) are passed to
the template. This means that when multiple footers, such as
`Signed-off-by:` and `Co-authored-by:` are present, it isn't currently
possible for the template to determine the name of the footer. This
makes actually using data from footers in templates impractical in most
cases.

This commit fixes this by changing the `Serialize` impl for `Commit` to
pass the commit's footers as a structured object rather than a string.
The structured `Footer` type includes the footer's token (which is what
`git_conventional` calls the name preceding the separator token), the
separator, and the value.

I didn't make the new `Footer` type and `Commit::footers` method public,
because it isn't strictly necessary to add them to the `git-cliff-core`
public API to fix this issue. However, we can make them public in a
follow-up PR if this is considered useful.

Fixes #96

BREAKING CHANGE:

This changes type of the `commit.footers` array exposed to templates.
Currently, when a template uses `commit.footers`, it can treat the
values as strings. After this change, the footer object will need to
have its fields unpacked in order to use them.

However, the impact of this breakage is probably not that severe, since
it's not really practical to use footers in templates with the current
system.

* docs(README): discuss footers in README

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* docs(examples): Add footers to `detailed.toml`

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* refac(commit): address review feedback

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* docs(README): address README review feedback

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

* refactor(example): update detailed example about newline issues

* test(fixture): add test fixture for commit footers

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2022-07-12 15:38:16 +03:00
..
test-commit-footers feat(commit)!: pass footer token and separator to template (#97) 2022-07-12 15:38:16 +03:00
test-commit-preprocessors fix(fixtures): update expected changelog date 2022-04-06 15:58:28 +03:00
test-custom-scope feat(config): support changing commit scope with commit_parsers (#94) 2022-06-23 02:44:13 +03:00
test-date-order feat(changelog, config)!: replace --topo-order by --date-order (#58) 2022-02-12 19:30:21 +03:00
test-date-order-arg feat(changelog, config)!: replace --topo-order by --date-order (#58) 2022-02-12 19:30:21 +03:00
test-ignore-tags fix(changelog): use root commit when --latest and there is only one tag (#59) 2022-02-20 17:26:11 +03:00
test-latest-with-one-tag fix(changelog): use root commit when --latest and there is only one tag (#59) 2022-02-20 17:26:11 +03:00
test-topo-order feat(changelog, config)!: replace --topo-order by --date-order (#58) 2022-02-12 19:30:21 +03:00
test-fixtures-locally.sh fix(changelog): use root commit when --latest and there is only one tag (#59) 2022-02-20 17:26:11 +03:00