Closed ppiecuch closed 2 years ago
Hi @ppiecuch I'm not sure what might be causing this, but it sounds like a bug we're not aware of since having zero-size encrypted files is an unusual use-case.
I'd recommend starting here, the internal git_clean
function that runs when git cleans (encrypts) files: https://github.com/elasticdog/transcrypt/blob/main/transcrypt#L137-L142
It deliberately handles zero-size files by returning nothing, but maybe that's not the right thing to do?
There are also a couple of other places in the code where empty files get special handling, look for comments with "empty file"
Since you're using a recent version of transcrypt, you can test by directly editing the .git/crypt/transcrypt file in your repository.
Just be sure to do so in a test repo so there's no risk of corrupting your real one.
Hi, thank you for quick respond :) No, any of these files is empty - these are just regular files: ls -l [some path]/[some file].h -rw-r--r-- 1 piecuchp staff 1339 Apr 5 2022 [some path]/[some file].h
Ah, I see. So the files in your working copy aren't empty, and are encrypted behind the scenes, but Git thinks they are empty?
Exactly - except the first one in that folder (it is README.md file), which reporting correct size. So first file reporting correct size and it is not reporting as modified. Remaining files reporting zero size and "modified" status
Do the problem files work if you clone your repo somewhere else and re-init transcrypt there? In the cloned repo are they decrypted properly, with the correct contents, and do they remain mistakenly modified in the new place?
Thanks, I will try that later. Meantime I have checked latest transcript on the same repository but on my other Mac - it also reports same files as modified (and one file as ok). But this time ls-files reports correct size for every file :)
I cloned fresh repository and reinit transcrypt: same situation - all files (except one) are reported as modified and ls-files reports zero size. Content is correct.
Just some more debugging info:
When I run: git diff [some path]/[some file].h ==== run clean ==== run clean ==== run textconv
transcrypt is running couple of times
When I run git diff on the single file that is not showing "modified" status (it is README.md - not sure if it is relevant) transcrypt is not called at all.
Finally I have just added/committed a modified files and seems like the problem is gone :)
Thanks for following up. I'm not sure what could have gone wrong to start with, but I'm glad it's working well for you now
os: macOS bigsur/monterey git: git version 2.37.0 (Apple Git-136) zsh transcript: latest
I have a folder added in gitattribute with / : [some path]/ filter=crypt diff=crypt merge=crypt Pretty much from the beginning of using transcript (I guess wayback 2.0 or 2.1) all files (except one) from added folder has been reported as modified. I finally spend some time recently on that and figure out that files that are modified reporting zero-size, eg:
git ls-files --debug [some path]/[some file].mm [some path]/[some file].mm ctime: 1649146859:598656217 mtime: 1649146859:598656217 dev: 16777233 ino: 9103104 uid: 502 gid: 20 size: 0 flags: 0
and git diff-index -u HEAD -- reports for these files: diff --git a/[some path]/[some file].h b/[some path]/[some file].h index d67c7af5df..9e8d142bba 100644 Binary files a/[some path]/[some file].h and b/[some path]/[some file].h differ
the only files that is fine, reporting correct size:
git ls-files --debug [some path]/README.md [some path]/README.md ctime: 1646857994:785285512 mtime: 1646312319:0 dev: 16777234 ino: 3569120 uid: 502 gid: 20 size: 8726 flags: 0
I am not sure if I am on a right track to solve that issues bur maybe someone could point me how I could debug more that problem? Where to look inside transcrypt?
Regards and thanks in advance