Repository navigation
Labels
bugSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Description of the bug
When setting --workdir <path> to the path of the repository or setting --workdir <parent-dir> to the parent of the repository: The git-cliff output is empty.
This used to work in 2.8.0. Maybe the meaning of --workdir changed related to some of the changes in the last few versions regarding --include-path, path resolution etc.
Steps To Reproduce
- Setup the repository:
mkdir git-cliff-workdir cd git-cliff-workdir/ git init git commit -m "feat: Changelog entry" --allow-empty
- These commands work as expected:
# from inside git-cliff-workdir/ # works git-cliff cd .. # works git-cliff --repository git-cliff-workdir
- These however, output an empty changelog:
# from inside git-cliff-workdir/ git-cliff --workdir . cd .. # from the parent directory of git-cliff-workdir/ git-cliff --workdir git-cliff-workdir/ git-cliff --repository git-cliff-workdir --workdir ./
Expected behavior
git-cliff should output the same changelog as for the other two commands, so for the example above:
## [unreleased]
### 🚀 Features
- Changelog entry
Screenshots / Logs
> ./git-cliff-workdir-repro.sh
+ mkdir git-cliff-workdir
+ cd git-cliff-workdir/
+ git init
...
+ git commit -m 'feat: Changelog entry' --allow-empty
[master (root-commit) 927f9d3] feat: Changelog entry
+ git-cliff
WARN git_cliff > "cliff.toml" is not found, using the default configuration
## [unreleased]
### 🚀 Features
- Changelog entry
+ git-cliff --workdir .
WARN git_cliff > "./cliff.toml" is not found, using the default configuration
+ cd ..
+ git-cliff --repository git-cliff-workdir
WARN git_cliff > "cliff.toml" is not found, using the default configuration
## [unreleased]
### 🚀 Features
- Changelog entry
+ git-cliff --workdir git-cliff-workdir/
WARN git_cliff > "git-cliff-workdir/cliff.toml" is not found, using the default configuration
+ git-cliff --repository git-cliff-workdir --workdir ./
WARN git_cliff > "./cliff.toml" is not found, using the default configuration
+ rm -rf git-cliff-workdir/Software information
- Project version:
git-cliff 2.12.0
Additional context
Might be related to:
- 2.11.0
- (args) Set the include-path if workdir is set (fix(args): set the include-path if workdir is set #1293) - (50b8312)
- 2.10.0
- (config) Support using include and exclude paths in the config (feat: add include and exclude path to the config #1173) - (7c2f922)
After further investigation:
- Since setting
--workdirnow also sets the include path, empty commits without any file changes will be ignored. - Absolute paths passed as
--workdirare not handled properly. The include patterns themselves include the absolute path, while the path of the files itself are compared using the relative path inRepository::should_retain_commit.
Reacted by Shingo OKAWA
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
felixoswald commentedon Feb 10, 2026
+1 for v2.12.0 and v2.11.0
running git cliff with the option
-w <path>in these versions results in an empty output.the last working version was 2.10.1
ids-mau commentedon Feb 12, 2026
I added some more information above. The problem seems to be related to
--workdirsetting the include path automatically, which ignores empty commits and the handling of absolute include paths in general.Repro script used:
orhun commentedon Feb 14, 2026
Hello, thanks for reporting! 👋🏼
Seems like this is caused by:
Those were implemented for fixing #1292
The issue is when adding the
workdirto theinclude_pathlist, we do not take the path relative to the repository root (which result in not including the files). I have vibe-coded a fix here which worked for me locally. However, our logic for resolving these path arguments is complex enough for now and just slapping would make the maintenance more difficult in the future.So I'd like to step back and think about how include-paths and other arguments interact with each other first and potentially refactor:
git-cliff/git-cliff/src/lib.rs
Lines 276 to 280 in 6a139f8
This might take some time but I believe we'll prevent future issues if we document the behavior and implement this cleanly.
cc @ognis1205
o1x3 commentedon Feb 17, 2026
Hey @orhun, I'd like to take a crack at the refactor you mentioned, consolidating the path resolution logic so workdir, include/exclude paths, and repository paths are all
normalized to repo-relative paths in one place.
My rough plan:
orhun commentedon Feb 21, 2026
Hey @o1x3, that would be great! Feel free to create a draft PR while you're working on this, so that we can track the progress and provide feedback early. (This is gonna be quite a big refactor I'm guessing)
ognis1205 commentedon Feb 21, 2026
@o1x3 cc: @orhun
If you're moving forward with the refactor, I'm happy to take care of:
and focus on improving the fixture/test coverage for the repository handling. That might help validate the refactor more confidently.
refactor(args): centralize include-path resolution after repo discovery
refactor(args): centralize include-path resolution after repo discovery
refactor(args): centralize include-path resolution after repo discovery
fix(args): resolve --workdir to a repo-relative include path (orhun#1369
fix(args): resolve --workdir to a repo-relative include path (orhun#1369
fix(args): resolve --workdir to a repo-relative include path (orhun#1369
fix(args): resolve --workdir to a repo-relative include path (orhun#1369
fix(args): resolve --workdir to a repo-relative include path (orhun#1369
fix(args): resolve --workdir to a repo-relative include path (orhun#1369