Skip to content

feat: add include and exclude path to the config #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 22, 2025

Conversation

Kriskras99
Copy link
Contributor

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)
  • 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:

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

@Kriskras99 Kriskras99 requested a review from orhun as a code owner June 11, 2025 13:38
Copy link

welcome bot commented Jun 11, 2025

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

@codecov-commenter
Copy link

codecov-commenter commented Jun 11, 2025

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 ⚠️
git-cliff-core/src/config.rs 0.00% 8 Missing ⚠️
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%) ⬇️

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 force-pushed the feat/include_and_exclude_path_in_config branch from a971cce to 1b40d79 Compare June 22, 2025 09:45
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@orhun orhun merged commit 7c2f922 into orhun:main Jun 22, 2025
86 checks passed
Copy link

welcome bot commented Jun 22, 2025

Congrats on merging your first pull request! ⛰️

@Kriskras99 Kriskras99 deleted the feat/include_and_exclude_path_in_config branch June 22, 2025 10:27
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.

3 participants