feat(config): search .cliff.toml as alternative config file name#1482
Open
niklasmarderx wants to merge 1 commit intoorhun:mainfrom
Open
feat(config): search .cliff.toml as alternative config file name#1482niklasmarderx wants to merge 1 commit intoorhun:mainfrom
niklasmarderx wants to merge 1 commit intoorhun:mainfrom
Conversation
When git-cliff looks for a configuration file it now checks both cliff.toml and .cliff.toml, in that order. Users who prefer dot-prefixed config files (a convention used by many other tools) can rename their file without any other changes. The new CONFIG_CANDIDATES constant drives all three lookup sites: - retrieve_config_path (user-level config dir, including legacy macOS) - the parent-directory walk in run_with_changelog_modifier DEFAULT_CONFIG and the --config default value are unchanged so existing setups are completely unaffected. Closes orhun#1446
|
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1482 +/- ##
==========================================
- Coverage 47.40% 47.35% -0.04%
==========================================
Files 24 24
Lines 2129 2131 +2
==========================================
Hits 1009 1009
- Misses 1120 1122 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1446
What this does
When git-cliff searches for a config file it now checks both
cliff.tomland.cliff.toml, in that order. Users who keep their configs under dot-prefixed names (a pattern common with.eslintrc,.rustfmt.toml,.prettierrc, etc.) can do the same for git-cliff without any extra flags.How it works
A new
CONFIG_CANDIDATESconstant ingit-cliff-corelists the names to try:All three lookup sites use this slice:
Config::retrieve_config_path— user-level config directory (and legacy macOS paths)run_with_changelog_modifier— the ancestor search that finds acliff.tomlin a parent directorycliff.tomlis still index 0, so it always wins over.cliff.tomlwhen both exist.DEFAULT_CONFIGand the--configdefault are unchanged, so existing setups are completely unaffected.Testing
Added a unit test to
config::testthat assertscliff.tomlis first inCONFIG_CANDIDATESand that.cliff.tomlis present.