git-cliff icon indicating copy to clipboard operation
git-cliff copied to clipboard

feat(core): add `remote` field to commit

Open marcoieni opened this issue 1 year ago • 2 comments

Description

Close #803

Add the remote field so that libraries using git-cliff-core can fill it. git-cliff can later use it after a refactoring.

Motivation and Context

https://github.com/orhun/git-cliff/issues/803#issuecomment-2310832669

How Has This Been Tested?

It's a trivial change, so I haven't tested it.

Screenshots / Logs (if applicable)

Types of Changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation (no code change)
  • [ ] Refactor (refactoring production code)
  • [ ] Other

Checklist:

  • [x] My code follows the code style of this project.
  • [x] I have updated the documentation accordingly.
  • [x] I have formatted the code with rustfmt.
  • [x] I checked the lints with clippy.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

marcoieni avatar Aug 27 '24 06:08 marcoieni

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 40.48%. Comparing base (08e761c) to head (1f90786). Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
git-cliff-core/src/contributor.rs 0.00% 2 Missing :warning:
git-cliff-core/src/changelog.rs 87.50% 1 Missing :warning:
git-cliff-core/src/commit.rs 50.00% 1 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #822      +/-   ##
==========================================
+ Coverage   40.13%   40.48%   +0.36%     
==========================================
  Files          20       21       +1     
  Lines        1645     1648       +3     
==========================================
+ Hits          660      667       +7     
+ Misses        985      981       -4     
Flag Coverage Δ
unit-tests 40.48% <69.24%> (+0.36%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 27 '24 06:08 codecov-commenter

Oh, I didn't get you wanted to move from commit.github to commit.remote in git-cliff as well. Cool 😁

Then, I'll work on this 👍

marcoieni avatar Aug 28 '24 03:08 marcoieni

Update the feature gates for remote so that the types can be exposed without requiring the integration to be enabled.

I extracted the RemoteContributor into git-cliff-core/src/remote_contributor.rs already. Do you think something else is necessary?

Also, please have another look at the PR and let me know there's something else I should do 👍

marcoieni avatar Aug 31 '24 07:08 marcoieni

Thanks for the update on the PR! A couple of points:

  1. We should either tune down the log level or check the config once and print warnings to avoid flooding the logs:

image

  1. We need to check for the presence of commit.remote variable alongside of e.g. github::TEMPLATE_VARIABLES constants.

  2. I don't like the place where remote_contributor.rs is sitting right now. Maybe we can rename it to contributor.rs or move it somewhere else. (I'm open to other ideas).

  3. Would be nice to update the existing examples/configs 🙂

orhun avatar Sep 01 '24 09:09 orhun

I addressed all points except 2. Could you handle it since it might be a bit involved? 👀

marcoieni avatar Sep 01 '24 11:09 marcoieni

We are still missing point 2 you mentioned before:

We need to check for the presence of commit.remote variable alongside of e.g. github::TEMPLATE_VARIABLES constants.

The tests are failing because we are not serializing the remote field.

How do you suggest to do this? (feel free to push to the branch if you prefer)

marcoieni avatar Sep 04 '24 19:09 marcoieni

Hmm, that's not good. Why are we not serializing it? I didn't get why the fixtures are failing because using commit.remote.* locally works for me.

orhun avatar Sep 04 '24 20:09 orhun

Imo the issue is that the git-cliff cli never sets the remote field of the Commit struct here: https://github.com/MarcoIeni/git-cliff/blob/aee8952fbdc191aca5663205bf3cd3e76f5f066d/git-cliff-core/src/release.rs#L64

but maybe that is only for the releases, not for the commits.

marcoieni avatar Sep 06 '24 05:09 marcoieni

CI is green now. Yeah 😎

marcoieni avatar Sep 06 '24 06:09 marcoieni

Thanks for reviewing and merging. Looking forward for the release!

I created the issue as you asked https://github.com/orhun/git-cliff/issues/856 👍

marcoieni avatar Sep 15 '24 17:09 marcoieni