Skip to content

feat(cli): honor XDG_CONFIG_HOME on macOS#1259

Merged
orhun merged 6 commits intoorhun:mainfrom
tessus:feat/xdg
Sep 20, 2025
Merged

feat(cli): honor XDG_CONFIG_HOME on macOS#1259
orhun merged 6 commits intoorhun:mainfrom
tessus:feat/xdg

Conversation

@tessus
Copy link
Contributor

@tessus tessus commented Sep 18, 2025

Description

git-cliff ignores the XDG_CONFIG_HOME env var on macOS and only considers Library/Application Support as the config dir, which is primarily used by GUI apps.

This change allows the default config file to be placed in the following 3 locations on macOS:

  • XDG_CONFIG_HOME/git-cliff/cliff.toml
  • ~/.config/git-cliff/cliff.toml
  • ~/Library/Application Support/git-cliff/cliff.toml

The first one found is used.

Motivation and Context

see #1249 (comment)

How Has This Been Tested?

manually and with debug output

Screenshots / Logs (if applicable)

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.

@tessus tessus requested a review from orhun as a code owner September 18, 2025 16:14
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.31%. Comparing base (9857d86) to head (0f98bf3).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
git-cliff-core/src/config.rs 0.00% 9 Missing ⚠️
git-cliff/src/lib.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1259      +/-   ##
==========================================
- Coverage   43.65%   43.31%   -0.33%     
==========================================
  Files          22       22              
  Lines        1982     1986       +4     
==========================================
- Hits          865      860       -5     
- Misses       1117     1126       +9     
Flag Coverage Δ
unit-tests 43.31% <0.00%> (-0.33%) ⬇️

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.

@tessus
Copy link
Contributor Author

tessus commented Sep 19, 2025

I don't have rust nightly installed, thus I cannot format the code.

It's the first time I have seen that a project uses nightly to check the formatting. Isn't this a bit fragile? Either way, I can install nightly later today or maybe you can format it if you have it installed.

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.

Looking pretty good! Just some minor points

@orhun
Copy link
Owner

orhun commented Sep 19, 2025

Yeah, you can format via cargo +nightly fmt. You don't need to switch to a nightly toolchain I believe.

@orhun
Copy link
Owner

orhun commented Sep 19, 2025

There is some discussion about nightly in #1184

It's not that breaking, unless you're switching to a new edition btw.

@tessus
Copy link
Contributor Author

tessus commented Sep 19, 2025

Yeah, you can format via cargo +nightly fmt. You don't need to switch to a nightly toolchain I believe.

Hmmm, nope:

$ cargo +nightly fmt
info: syncing channel updates for 'nightly-x86_64-apple-darwin'
info: latest update on 2025-09-19, rust version 1.92.0-nightly (7c275d09e 2025-09-18)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'

Anyway, when I ran it, much less was fixed than what was shown in the pipeline. Let's see, if it now runs through.

P.S.: Switching is not necessary, but now it will download the nightly almost every time I use cargo +nightly fmt since nightly is released every day.

@tessus
Copy link
Contributor Author

tessus commented Sep 19, 2025

Nice, the formatting seems ok. Issues with link validation are not related to this PR. So we should be good.

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 6b8f1dc into orhun:main Sep 20, 2025
90 of 91 checks passed
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