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

Ignore .git-blame-ignore-revs hashes

Open michen00 opened this issue 8 months ago • 6 comments

Is there an existing issue or pull request for this?

  • [x] I have searched the existing issues and pull requests

Feature description

git cliff would ignore

  • any commits referenced in .git-blame-ignore-revs
  • any commits that modify only .git-blame-ignore-revs

(if the file exists).

Desired solution

A config to enable this in the .toml file would be great. I think it makes sense to enable the latter option by default too.

Alternatives considered

I had a convention for commits updating that file, so I wrote a pattern for it. Then halfway through the project, I updated that convention, so I wrote another pattern. But what if I didn't have a convention?

Additional context

No response

michen00 avatar Mar 10 '25 02:03 michen00

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

welcome[bot] avatar Mar 10 '25 02:03 welcome[bot]

Hey, thanks for creating the issue. I agree that this would be a nice addition :)

We already support a .cliffignore file for skipping commits. This is something similar to that, right? If so, that should be very straightforward.

Would you be interested in contributing this?

orhun avatar Mar 10 '25 21:03 orhun

I am interested in contributing this! But to be honest, I'm not sure I will have the bandwidth to do so in a timely manner. If someone were to do it faster than me, I wouldn't mind and would appreciate using the feature.

But I did start drafting some edits. I created a draft PR in case you'd like to check in to see what direction I'm headed in. I'm just starting to learn Rust, so any feedback would be welcomed 👍

michen00 avatar Mar 12 '25 04:03 michen00

Hey @michen00, thanks for picking this up!

Would be better if you can submit the draft PR on this repo instead of your fork.

For the first step of the implementation, I'm thinking if we should have sane defaults instead of supporting configuration for this feature. e.g. we only support ".git-blame-ignore-revs" file and always filter_mono_commits_to_blame_ignore=true. What do you think?

orhun avatar Mar 14 '25 16:03 orhun

What do you think?

Yeah, this sounds sensible and easier to achieve than supporting full configuration. Let's start with this for the first step.

submit the draft PR on this repo instead

I'll clean up my commits and re-submit here.

always filter_mono_commits_to_blame_ignore=true

Yes 👍 : I can't imagine wanting (chore|docs): add yet another hash to ignore in blame in the changelog.

we only support ".git-blame-ignore-revs" file

For the next step of the implementation, I'm a little hesitant. This file can be configured via git config blame.ignoreRevsFile. Should we read it with something like git config --get blame.ignoreRevsFile? Or should it become a sane but configurable default?

michen00 avatar Mar 15 '25 00:03 michen00

I think having it as a sane default would be the way to go. I don't want to do much git operations in git-cliff - but it's worth checking out if git2 already has support for it (which is the Git handling library that git-cliff depends).

orhun avatar Mar 19 '25 22:03 orhun