question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS Code does not respect the diff flag in .gitattributes

See original GitHub issue

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.69.0
  • OS Version: Windows 10.0.1.19044

Steps to Reproduce:

  1. Open a local git repository in vscode

  2. Make changes to a file 1.txt, and then add this simple .gitattributes file:

     *.txt -diff
    
  3. Confirm output of git diff on the terminal: Binary files a/1.txt and b/1.txt differ

  4. View the diff from VS Code Source Control panel.

Expected output:

VS Code source control panel shows “No preview available, binary files a/1.txt and b/1.txt differ” or a similar message.

Actual output:

VS Code shows the plaintext diff.

Context: I intend to unset the diff flag for certain large auto-generated files in my project. If I accidentally open their diff on the VS Code Source Control, currently, there is a noticeable lag (less than a second) and the rendered diff itself is unusable anyway. So, I’d prefer if VS Code just didn’t attempt to display the diff in the first place.

Cross-ref: SO post that I made two weeks ago about the same issue.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
GaurangTandoncommented, Jul 11, 2022

Nice catch. I had written 1.6.90 instead of 1.69.0, fixed now.

0reactions
lszomorucommented, Sep 29, 2022

@GaurangTandon, sorry this issue got lost in my notifications. I will try to take a quick look later this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make VS Code respect the diff flag in .gitattributes?
I made changes to a file 1.txt , and then added this simple .gitattributes file: *.txt -diff. The output of git diff is...
Read more >
Visual Studio for Git does not respect .gitattributes for custom ...
I want to use a custom diff-tool in Visual Studio (2019) for specific file types, for example, I want to use the default...
Read more >
Git Attributes - GitLab Documentation
The .gitattributes file must be encoded in UTF-8 and must not contain a Byte Order Mark. If a different encoding is used, the...
Read more >
git-config Documentation - Git
This command will fail with non-zero status upon error. Some exit codes are: The section or key is invalid (ret=1),. no section or...
Read more >
CRLF vs. LF: Normalizing Line Endings in Git
A better solution is to add a .gitattributes file to your repo so you can enforce line endings consistently in your codebase regardless...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found