Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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 am currently using
git-cryptin tandem with somepre-commithooksUpon adding a new file for encryption --> a corresponding
.gitattributesentry -->git commit -m "blah"I encounter the following error:git version:
2.18.0pre-commit version:
1.10.2.pre-commit-config.yaml
.gitattributes: