-
Notifications
You must be signed in to change notification settings - Fork 243
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
Buf breaking: fatal: .git/index: index file open failed: Not a directory #2463
Comments
I have the same problem. @jalaziz Did you find a workaroud? |
@ddadonJoin Unfortunately not 😞. I had to disable it for now. |
i have the same issue, i think its because the repo is cloned with --bare. So there is no .git directory or index file. But not sure |
TL;DR run I sort of figured why this happens. The culprit is env variable GIT_INDEX_FILE which is normally set to ".git/index" when hooks are running. See in https://git-scm.com/docs/githooks :
This "If your hook needs to invoke Git commands in a foreign repository" applies to buf, as it creates temp bare repo and adds there a worktree, which is where it currently breaks for me due to GIT_INDEX_FILE pointing to that relative path ".git/index". Following what doc says and running More precise |
I'm trying to use the buf breaking hook with pre-commit and I am running into an odd problem that I have not been able to debug.
My
pre-commit
config looks like:When run with
pre-commit run --all-files
everything works fine.However, when I attempt to commit changes that affect proto files, buf breaking fails with:
The text was updated successfully, but these errors were encountered: