-
-
Notifications
You must be signed in to change notification settings - Fork 283
Setting --workdir results in an empty output #1369
Copy link
Copy link
Labels
bugSomething isn't workingSomething 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working