GNU bug report logs - #79050
vc-git incorrectly treats git-crypt encrypted files as binary, even when unlocked

Previous Next

Package: emacs;

Reported by: James Cherti <contact <at> jamescherti.com>

Date: Sat, 19 Jul 2025 18:01:02 UTC

Severity: normal

Tags: notabug

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: James Cherti <contact <at> jamescherti.com>
Subject: bug#79050: closed (Re: bug#79050: vc-git incorrectly treats
 git-crypt encrypted files as binary, even when unlocked)
Date: Mon, 21 Jul 2025 08:28:02 +0000
[Message part 1 (text/plain, inline)]
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 79050 <at> debbugs.gnu.org.

-- 
79050: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79050
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Sean Whitton <spwhitton <at> spwhitton.name>
To: James Cherti <contact <at> jamescherti.com>
Cc: 79050-done <at> debbugs.gnu.org
Subject: Re: bug#79050: vc-git incorrectly treats git-crypt encrypted files
 as binary, even when unlocked
Date: Mon, 21 Jul 2025 09:27:14 +0100
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

[Message part 3 (message/rfc822, inline)]
From: James Cherti <contact <at> jamescherti.com>
To: bug-gnu-emacs <at> gnu.org
Subject: vc-git incorrectly treats git-crypt encrypted files as binary, even
 when unlocked
Date: Sat, 19 Jul 2025 13:59:40 -0400
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/




This bug report was last modified 10 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.