Subject: Re: bug#79050: vc-git incorrectly treats git-crypt encrypted files as binary, even when unlocked

From: James Cherti <[email-masked]>
Date: Tue, 22 Jul 2025 09:27:03 -0400

On 2025-07-22 06:36, Sean Whitton wrote:
> tag 79050 + notabug
> notfixed 79050 31.1
> thanks
> 
> Hello,
> 
> On Tue 22 Jul 2025 at 09:45am +03, Juri Linkov wrote:
> 
>> Also I remember a minor inconvenience that "--textconv" makes `git diff`
>> too slow on encrypted files.  Most of the time there is no need
>> to see decrypted text in diff output.  So I prefered to add "--textconv"
>> only occasionally: mostly to verify the encrypted content before committing
>> changes, but not when viewing logs with diff.
> 
> Interesting.

That's a fair point, but I would argue that the default
behavior should favor clarity and discoverability,
especially for users who aren't already aware of the
interaction between git-crypt and --textconv.

While --textconv may introduce some overhead when decrypting
large files during git diff, the benefit of getting
intelligible output, rather than opaque binary diffs, is
significant in most real-world workflows. Users encountering
unreadable diffs are unlikely to immediately suspect the
absence of --textconv; they're more likely to assume
something is broken in Emacs or in a package they are using
(e.g., diff-hl).

>> Would it be possible to enable this optionally?
>> Maybe a simple variable would suffice.

This is a much better alternative than simply reverting the
change.

> Another problem is that you can't commit changes from *vc-diff* buffers
> with --textconv, and if you try to do so anyway, it might break things
> in your repository, without you realising.

Out of curiosity, how can I reproduce the issue that occurs
when committing from a vc-diff buffer with --textconv?

> Therefore I think that users should have to add this to
> vc-git-diff-switches themselves if they want this.  I'll revert the
> change.

If the change is simply reverted, some users may not
discover that their issue can be addressed by using the
--textconv option.

Providing this behavior as an optional, user-configurable
variable would make its existence visible through the
docstring. This could help reduce confusion and the time
users spend investigating why vc-diff appears broken or
why tools like diff-hl fail to work correctly in
repositories that use git-crypt:
https://github.com/dgutov/diff-hl/issues/244#issuecomment-3102297241

--
James Cherti
GitHub: https://github.com/jamescherti
Website: https://www.jamescherti.com/