git-crypt icon indicating copy to clipboard operation
git-crypt copied to clipboard

Make `git add --patch` work on encrypted files?

Open krish7919 opened this issue 7 years ago • 2 comments

I have a large encrypted file which, when changed, is easier to review and commit using git add -p.

However, when I run a git add --patch on such a file, I get a Only binary files changed. message from git. I can see from the Git docs that the textconv option might not be used here.

Would it be possible to add support for this in git-crypt ?

Failing which, is there a workaround that I can do in my .gitconfig that can resolve this issue?

Thanks!

krish7919 avatar Jan 27 '19 04:01 krish7919

:+1: ditto on any temporary .gitconfig fix

bqv avatar Apr 02 '20 19:04 bqv

I think this must be fixed in Git itself, not in this project. From what I can tell, git add -p always operates on the output of the clean command (encrypt in this case), never on the output of the smudge command (decrypt).

(I think the right way to fix this is to change Git so that it runs the index's version of the file through the smudge command, and the working directory's version through a clean then smudge cycle, before diffing the results and prompting for hunks to add.)

rhansen avatar Sep 21 '21 22:09 rhansen