Skip to content

feat(git): skip commits listed in .git-blame-ignore-revs#1548

Open
arieleli01212 wants to merge 6 commits into
orhun:mainfrom
arieleli01212:feat/blame-ignore-revs
Open

feat(git): skip commits listed in .git-blame-ignore-revs#1548
arieleli01212 wants to merge 6 commits into
orhun:mainfrom
arieleli01212:feat/blame-ignore-revs

Conversation

@arieleli01212

Copy link
Copy Markdown

Closes #1084.

When a .git-blame-ignore-revs file exists at the repository root, git-cliff now automatically skips any commit whose SHA is listed in it.

This follows the same approach as .cliffignore: the file is parsed for non-comment, non-empty lines (each line being a commit SHA), and each SHA is added to the skip list as a CommitParser with skip = true. No configuration is needed — it's always-on when the file is present, matching the "sane defaults" direction discussed in the issue.

The .git-blame-ignore-revs format is identical to what git blame --ignore-revs-file expects:

  • Lines starting with # are comments and are ignored
  • Blank lines are ignored
  • All other lines are treated as commit SHAs

Changes:

  • git-cliff-core/src/lib.rs — add BLAME_IGNORE_REVS_FILE constant
  • git-cliff/src/lib.rs — read the file and extend the skip list, right after the existing .cliffignore handling

arieleli19 and others added 6 commits May 27, 2026 19:03
…ching feature

When a user's template references variables like `github.contributors`
or `commit.gitlab` but the binary was compiled without the corresponding
feature flag (`github`, `gitlab`, etc.), the rendering silently produces
empty output with no indication of why.

Add a `warn_if_remote_template_variables_without_feature` check in
`Changelog::build` that emits a `tracing::warn` for each remote whose
template variables are present but whose Cargo feature is absent.

Fixes orhun#659
…abled

The warn_if_remote_template_variables_without_feature function declared a
`templates` Vec that was only accessed inside cfg-gated blocks. When all
remote features are compiled in (the default build), every
`#[cfg(not(feature = "..."))]` condition is false, so `templates` is never
read — triggering an unused-variable error under `-D warnings`.

Restructure: move the templates array construction inline inside each
macro expansion. Each branch is self-contained and only compiled when the
corresponding feature is absent, so there is no unused variable in any
build configuration.
Track all PR numbers for a contributor within a single release in a
new `pr_numbers: Vec<i64>` field, sorted in ascending order. The
existing `pr_number` field is preserved for backward compatibility.
@arieleli01212 arieleli01212 requested a review from orhun as a code owner June 1, 2026 14:15
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.11111% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.65%. Comparing base (772e01d) to head (d1d9530).

Files with missing lines Patch % Lines
git-cliff/src/lib.rs 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1548      +/-   ##
==========================================
+ Coverage   48.65%   48.65%   +0.01%     
==========================================
  Files          26       26              
  Lines        2288     2296       +8     
==========================================
+ Hits         1113     1117       +4     
- Misses       1175     1179       +4     
Flag Coverage Δ
unit-tests 48.65% <61.12%> (+0.01%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! It looks good, however it seems like there are some unrelated changes included (in changelog, commit, etc. modules) Can you check?

Comment thread git-cliff/src/lib.rs
Comment on lines +789 to +798
let blame_ignore_file = repository.root_path()?.join(BLAME_IGNORE_REVS_FILE);
if blame_ignore_file.exists() {
let contents = fs::read_to_string(&blame_ignore_file)?;
let commits = contents
.lines()
.filter(|v| !(v.starts_with('#') || v.trim().is_empty()))
.map(|v| String::from(v.trim()))
.collect::<Vec<String>>();
skip_list.extend(commits);
}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this the essence of this PR and it looks good :)

We can remove the rest of the changes (and possibly update the documentation about this change)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore .git-blame-ignore-revs hashes

4 participants