Skip to content
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(changelog): expose commits sha1, author and author_email in changelog tree (fix #987) #1013

Merged

Conversation

noirbizarre
Copy link
Member

@noirbizarre noirbizarre commented Mar 10, 2024

Description

This PR adds the sha1, author and author_email field to each commit/changelog change.

Fixes #987

Checklist

  • Add test cases to all the changes you introduce
  • Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

Template can access sha1, author and author_email on each changelog entry

Steps to Test This Pull Request

Override the changelog template and try using change.sha1, change.author and change.author_email, it should be defined for each.

Additional context

This change is easy but comes with a drawback which needs discussion before merge:
this is really increasing memory usage by commit. While it is impact-less on small repositories, it can make commitizen not fit in memory on big repositories (might need an estimation to measure impact).

So we need to discuss whether the overhead is acceptable or not and if this is OK should be merged as it is, opt-in and protected by a flag, a plugin only feature (consistent with the fact that we need a template to benefit from those variables) or just something to add as a changelog_message_builder_hook (and we just provide the recipe)

My opinion: I am OK with this change, I just need to make an estimation of the overhead to decide.

Copy link

codecov bot commented Mar 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.45%. Comparing base (120d514) to head (8492af8).
Report is 210 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1013      +/-   ##
==========================================
+ Coverage   97.33%   97.45%   +0.11%     
==========================================
  Files          42       55      +13     
  Lines        2104     2395     +291     
==========================================
+ Hits         2048     2334     +286     
- Misses         56       61       +5     
Flag Coverage Δ
unittests 97.45% <100.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@noirbizarre noirbizarre merged commit bbae8e0 into commitizen-tools:master Mar 19, 2024
18 checks passed
@noirbizarre noirbizarre deleted the feature/author-and-sha1 branch March 19, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can you add the commit sha1 in the changelog command?
2 participants