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

feat: add include and exclude path to the config

Open Kriskras99 opened this issue 5 months ago • 2 comments

Description

This PR adds the option of setting include_path and exclude_path in the config file.

Motivation and Context

Closes #1168. This is useful if you have tools calling git-cliff (like release-plz) that don't give the ability to set command line arguments.

How Has This Been Tested?

Testing exclude_path

  1. Run git-cliff | wc -l and note the amount of lines
  2. Run git-cliff --exclude-path git-cliff-core/ | wc -l and note the amount of lines
  3. Set exclude-paths = ["git-cliff-core/"]
  4. Run git-cliff | wc -l and note the amount of lines The output of step 4 should equal the output of step 2 and not equal the output of step 1

Testing include_path

  1. Run git-cliff | wc -l and note the amount of lines
  2. Run git-cliff --include-path git-cliff/ --include-path git-cliff-core/ | wc -l and note the amount of lines
  3. Set include_paths = ["git-cliff/", "git-cliff-core/"]
  4. Run git-cliff | wc -l and note the amount of lines The output of step 4 should equal the output of step 2 and not equal the output of step 1

Both tests were run in the root of the git-cliff repository on a Linux machine.

I could not figure out how to mock commits with changed files and thus have not written any unit/integration tests.

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)
  • [x] 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.
  • [x] All new and existing tests passed.

Kriskras99 avatar Jun 11 '25 13:06 Kriskras99

Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️

welcome[bot] avatar Jun 11 '25 13:06 welcome[bot]

Codecov Report

Attention: Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.

Project coverage is 41.87%. Comparing base (871c3c9) to head (19afa3d).

Files with missing lines Patch % Lines
git-cliff/src/lib.rs 0.00% 17 Missing :warning:
git-cliff-core/src/config.rs 0.00% 8 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1173      +/-   ##
==========================================
- Coverage   42.35%   41.87%   -0.47%     
==========================================
  Files          21       21              
  Lines        1991     2011      +20     
==========================================
- Hits          843      842       -1     
- Misses       1148     1169      +21     
Flag Coverage Δ
unit-tests 41.87% <0.00%> (-0.47%) :arrow_down:

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.

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

codecov-commenter avatar Jun 11 '25 13:06 codecov-commenter

Congrats on merging your first pull request! ⛰️

welcome[bot] avatar Jun 22 '25 10:06 welcome[bot]