You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried a naive docker compose exec wca_on_rails bash -c "RAILS_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec overcommit --run", but it failed with:
Unable to determine location of GIT_DIR. Not a recognizable Git repository! (Overcommit::Exceptions::InvalidGitRepo)
Because the ownership in the mounted volume looks weird to git:
root@13d2792a7393:/app# git status
fatal: detected dubious ownership in repository at '/app'
To add an exception for this directory, call:
git config --global --add safe.directory /app
Running the suggested command let me ran the CI's overcommit commands, but expectedly it changes the .git/config file and sets the ownership to root (which is not what I would expect/like).
One of these must be true:
you have an alternate way of running overcommit locally, and it would be great to document it :)
you don't run overcommit locally and rely on the CI to tell when your code is wrong (:scream:)
you do it the way I did, and in these cases I'd suggest to not use root as the container's user (using user id 1000 is better than nothing, but ideally we'd get the user id to use from the mounted volume)
Apart from that running overcommit the way I did mostly worked, even though it did complain about the commit information:
Running pre-commit hooks
Check for author name....................................[AuthorName] FAILED
Author name must be non-0 in length.
Set your name with `git config --global user.name "Your Name"` or via the GIT_AUTHOR_NAME environment variable
Check author email......................................[AuthorEmail] FAILED
Author has an invalid email address: ''
Set your email with `git config --global user.email [email protected]` or via the GIT_AUTHOR_EMAIL environment variable
(the commit information are actually correct, I think it may be confused because of the aforementioned difference in container/host users)
The text was updated successfully, but these errors were encountered:
I can't speak for the whole team, but I personally do rely on the CI for the Overcommit hooks.
I don't perceive the code as being "wrong", and the entire Overcommit "chain" is so lengthy, complicated to setup -- and cumbersome in the way that it mangles your git installation with sign, pre-sign, verify and whatnot... -- that the trouble of setting it up is just not worth it for me
How do you guys do it these days?
I've tried a naive
docker compose exec wca_on_rails bash -c "RAILS_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec overcommit --run"
, but it failed with:Because the ownership in the mounted volume looks weird to git:
Running the suggested command let me ran the CI's overcommit commands, but expectedly it changes the
.git/config
file and sets the ownership toroot
(which is not what I would expect/like).One of these must be true:
root
as the container's user (using user id 1000 is better than nothing, but ideally we'd get the user id to use from the mounted volume)Apart from that running overcommit the way I did mostly worked, even though it did complain about the commit information:
(the commit information are actually correct, I think it may be confused because of the aforementioned difference in container/host users)
The text was updated successfully, but these errors were encountered: