Is there an existing issue for this?
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:
After further investigation:
- Since setting
--workdir now also sets the include path, empty commits without any file changes will be ignored.
- Absolute paths passed as
--workdir are not handled properly. The include patterns themselves include the absolute path, while the path of the files itself are compared using the relative path in Repository::should_retain_commit.
Is there an existing issue for this?
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: Thegit-cliffoutput is empty.This used to work in
2.8.0. Maybe the meaning of--workdirchanged related to some of the changes in the last few versions regarding--include-path, path resolution etc.Steps To Reproduce
Expected behavior
git-cliffshould output the same changelog as for the other two commands, so for the example above:Screenshots / Logs
Software information
git-cliff 2.12.0Additional context
Might be related to:
After further investigation:
--workdirnow also sets the include path, empty commits without any file changes will be ignored.--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.