Skip to content

git-cliff-core: allow adding arbitrary values to commits #803

@marcoieni

Description

@marcoieni

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

First of all thank you for the amazing crate and the hard work you put into it 🙏

I would like to attach a remote context to the commit, so that people can write commit.remote.username in release-plz changelog (which is similar to commit.github.username git-cliff equivalent.

Even though I can't have commit.remote I tried enabling the "github" feature and my Cargo.lock exploded because of many dependencies to retrieve remote info I'm not using (because I'm retrieving remote info by myself). So I would like to have a "lighter" way to add arbitrary fields to the commit object.

So a very similar mechanism to #613 but limited to the commit object.

Desired solution

The Commit struct could have a Map of <String, Json> (this is psudo-code). In my example, "String" is remote and Json is { author }.

Library users should be able to add any fields they like to it.

Alternatives considered

The alternative is rely entirely on git-cliff for commits remote info retrieval.

My issue is that I generate multiple changelogs that share some commits, so we would hit GitHub API multiple times for the same commits for no reason.
We could solve this by implementing #468 but I'm not sure if it's easier than this issue.

Also, with this approach, the following problems remain:

  • I would like to have commit.remote instead of commit.github, commit.gitea, etc. (unless you change my mind that commit.github is a better idea 👀)
  • I prefer to avoid adding all those dependencies because release-plz already takes a while to compile 😵

Additional context

PR where I experimented: release-plz/release-plz#1630

Also, I'm curious, why you have commit.github, commit.gitea, etc instead of a unified solution (e.g. commit.remote)?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions