betterer
betterer copied to clipboard
Error: .git directory not found. Betterer must be used within a git repository.
Describe the bug
Betterer requires a .git
directory
To Reproduce
Run betterer ci
without a .git
directory.
Expected behavior I expected betterer to create a new results file and use diff (or something like it) in order to check for differences.
Screenshots N/A
Versions (please complete the following information):
- OS: Linux
- Betterer Version: 5.4.0
- Node Version: 16.x
Additional context I don't really understand why it would need git in the CI
This is by design, as git is useful for more than just diff checking, (e.g. for maintaining the cache), and most CI systems are have got available for cloning the project they are building. Not planning on changing this, but happy to look at a PR.
I hope you might reconsider, if you are using a multi-stage Dockerfile for testing, requiring git to work properly means the entire layer is uncachable since you have to copy the ./.git
directory which changes on each commit regardless if any files have actually changed.
Fair enough, I'll have a think
I agree with @davidbarratt that multi-stage Dockerfile's are very common in CI. Requiring .git
essentially rules out this tool for anyone using that workflow.
I haven't looked at this library close enough yet to understand how difficult it will be to remove the requirement but if you have any ideas I am happy to try and help contribute to a fix.
This is an issue for us as well, our CI uses docker and doesn't copy over the .git
folder.
Just ran into this issue as well, and git is just used to list files, so git init && git add . && git commit -m dummy
works as a workaround, but it's ugly, and the dependency on git should just be removed or have a flag to toggle off.