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

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 21 Jul 2025 08:28:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79050: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79050
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79050: vc-git incorrectly treats git-crypt encrypted files as binary, even when unlocked
From: Sean Whitton <[email-masked]>
To: James Cherti <[email-masked]>
Cc: [email-masked]
Date: Mon, 21 Jul 2025 09:27:14 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 31.1

Hello,

On Sun 20 Jul 2025 at 02:28pm -04, James Cherti wrote:

> Hello Sean,
>
> Yes, adding `--textconv` resolves the issue.

Thanks for testing.  Installed that change, and closing the bug.

-- 
Sean Whitton

Subject: vc-git incorrectly treats git-crypt encrypted files as binary, even when unlocked
From: James Cherti <[email-masked]>
To: [email-masked]
Date: Sat, 19 Jul 2025 13:59:40 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

When using vc-diff in a Git repository where all files are
encrypted with git-crypt https://github.com/AGWA/git-crypt
the output does not reflect actual changes. Modified files
appear unaltered, regardless of edits made. (vc-diff appears
to compare the encrypted binary representations of the files,
rather than their decrypted contents.)

It appears that vc-diff does not take .gitattributes into
account, even though Git itself uses it to determine how to
handle diff filters. As a result, while git diff correctly
shows textual diffs for git-crypt encrypted files (once the
repository is unlocked), Emacs vc-diff treats them as binary
and fails to display the actual changes.

Instead of showing a textual diff, vc-diff reports:
   diff --git a/file b/file
   index a134576..8b24729 100644
   Binary files a/file and b/file differ

Steps to Reproduce:
-------------------
1. Initialize a Git repository and enable git-crypt.
      Create the repo:
      ----------------
      mkdir -p repo
      cd repo
      git init
      git-crypt init
      echo test > README.md

      Create the .gitattributes file:
      -------------------------------
      ** filter=git-crypt diff=git-crypt
      .gitattributes !filter !diff

      Commit:
      -------
      git add .
      git commit -m 'Init'
2. Open the README.md file in Emacs and modify it.
3. Run: M-x vc-diff

Expected Behavior
-----------------
vc-diff should display a textual diff showing the modified lines.

Actual Behavior
---------------
vc-diff reports the file as a binary difference with no
line-level changes, even though the repository is unlocked
and git diff in the terminal shows the correct diff.

Environment:
------------
- Emacs version: 31 (3b2bfdfef63f051a36f4043c32596458ccae605f)
                  2025-07-19 13:05:05 +0300
- OS: Arch Linux

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