-
-
Notifications
You must be signed in to change notification settings - Fork 767
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
git apply error when using git-crypt #776
Comments
Thanks for the report! could you provide some more information (if possible) for me? it appears from the output that you committed with an unstaged change, to which file was that and if possible could you share the patch file mentioned? I suspect the |
thanks for your prompt response @asottile. Context:
The change which triggered the error is creating an empty file .gitattributes
The patch file corresponding to the above change
Do let me know if you need further info |
ok, I have a reproduction: #!/usr/bin/env bash
set -euxo pipefail
rm -rf repo
git init repo
cd repo
git commit --allow-empty -m 'Initial empty commit'
git-crypt init
cat > .pre-commit-config.yaml << EOF
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: trailing-whitespace
EOF
git add .pre-commit-config.yaml
pre-commit install
git commit -m "Add pre-commit config"
echo 'f filter=git-crypt diff=git-crypt' > .gitattributes
git add .gitattributes
echo 'hello world' > f
git add f
rm f && touch f
git commit -m "test" which ends with:
Almost certainly due to the smudge filter though I'm not exactly sure what the correct approach is here -- for now you can work around this by making sure you stage the encrypted files before committing. |
This is how i've worked around it for the time being:
|
hmm, my crash is actually different from yours -- I wonder there's two issues here :S |
I encountered a similar issue as well, here's the log. This is reproduced in some repos that have implemented some clean filters, with some test cases files intentionally committed uncleaned for testing. |
Wondering if there was an update on this issue? If there are any hints on what the issue might be, I'd be keen to offer help fixing - it's something we run into frequently |
I started looking into this from the the current known workaround is to make sure such files are I'm not sure what it would take to fix this, I suspect a fix from |
Many thanks @asottile, that all sounds very non-trivial |
yeah :'( that's why I haven't dug into it yet beyond the repro above |
Hi! I've got the same issue:
.pre-commit-config.yml
|
it solved for me as it turned out there were a couple of empty files. I took a look inside /Users/yulia/.cache/pre-commit/pre-commit.log and noticed that 1 commit ago I committed 2 totally empty secrets files. So I filled them in.
|
I can confirm that this issue was resolved for me by making sure I wasn't staging empty files that matched my |
interestingly, adding |
I submitted a more thorough investigation to the git mailing list -- https://marc.info/?l=git&m=166733577332408&w=2 |
Hi. I am currently using
git-crypt
in tandem with somepre-commit
hooksUpon adding a new file for encryption --> a corresponding
.gitattributes
entry -->git commit -m "blah"
I encounter the following error:git version:
2.18.0
pre-commit version:
1.10.2
.pre-commit-config.yaml
.gitattributes:
The text was updated successfully, but these errors were encountered: