Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: .git directory not found. Betterer must be used within a git repository. #1129

Open
davidbarratt opened this issue Mar 13, 2023 · 7 comments
Milestone

Comments

@davidbarratt
Copy link

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

@phenomnomnominal
Copy link
Owner

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.

@davidbarratt
Copy link
Author

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.

@phenomnomnominal
Copy link
Owner

Fair enough, I'll have a think

@mtimbs
Copy link

mtimbs commented Mar 21, 2023

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.

@martsie
Copy link

martsie commented Aug 22, 2023

This is an issue for us as well, our CI uses docker and doesn't copy over the .git folder.

@slikts
Copy link

slikts commented Jun 26, 2024

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.

@phenomnomnominal
Copy link
Owner

Almost done with v6 so thinking about the future of this, and I guess most of what Betterer uses git for could be replaced by traversing the file structure and then respecting a .gitignore file if it is present?

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

No branches or pull requests

5 participants