elasticdog / transcrypt

transparently encrypt files within a git repository
MIT License
1.44k stars 102 forks source link

using transcrypt on LFS files #129

Open qmarcou opened 2 years ago

qmarcou commented 2 years ago

Hi! First of all thanks for this great and simple tool!

I was wondering if there was a way to use transcrypt on LFS files? Upon trying to do it I realized that both LFS and transcrypt use .gitattributes, e.g trying to encrypt a file on lfs I would use:

git lfs track "mybiggfile.csv"
echo "mybigfile.csv filter=crypt diff=crypt merge=crypt"

and would obtain the following .gitattributes

mybigfile.csv filter=lfs diff=lfs merge=lfs
mybigfile.csv filter=crypt diff=crypt merge=crypt

And upon staging the file it will be encrypted but not treated as LFS file. Is there a workaround to get both working together? Thanks for your help!

jmurty commented 2 years ago

Hi,

I don't think there is an easy way to apply multiple filter etc options on the same file. Doing this would involve carefully chaining the two separate tools so they work together, which might be possible but would be difficult to get right.

Googling Git filter chaining returned few results, none of them very promising like https://stackoverflow.com/questions/13988619/apply-multiple-filters-for-same-files-in-git

Making Transcrypt compatible with LFS would be an interesting exercise if you want to give it a try?