4

I have git version 2.17.0.windows.1 on my Windows 10 computer. As far as I know, git shouldn't be able to diff pdf files out of the box. I've always expected the diff message to just say something like "Binary files a.pdf and b.pdf differ".

So I was surprised to see the console print this out one day in a repository with a pdf file that had been updated:

diff --git a/assign6.pdf b/assign6.pdf
index 6e6e292..cf8f0bc 100644
--- a/assign6.pdf
+++ b/assign6.pdf
@@ -6,7 +6,7 @@

                            Late Date: NO LATE

-                                               November 10, 2018
+                                               November 26, 2018

 This assignment introduces tasks with public members, direct communication and high-level techniques for structuring
 complex interactions among tasks (versus monitor and semaphore structuring approaches). Use it to become familiar

I'm aware that there's a way to show human-readable diffs for binary files using a textconv setting in gitconfig and diff attributes for specific file extensions in gitattributes, but I certainly haven't done anything like that for my computer. I simply installed git using the exe installer, and I haven't really changed any configuration settings since then.

This is what git config --list shows when inside that folder:

core.symlinks=false
core.autocrlf=false
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
user.email={{super secret email}}
user.name={{super secret username}}
core.pager=less
core.autocrlf=false
core.whitespace=cr-at-eol
color.ui=auto
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url={{super secret url}}
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

I initially thought this was some new fancy feature that had been recently added into git, but when I tried the diff over on an Ubuntu 16.04 machine with git version 2.19.0, this is what the console printed out:

diff --git a/assign6.pdf b/assign6.pdf
index 6e6e292..cf8f0bc 100644
Binary files a/assign6.pdf and b/assign6.pdf differ

So... doesn't seem like it?

Then where is this magical unicorn pdf diff behaviour coming from? Where is this configured?

ahiijny
  • 351
  • 1
  • 6
  • 21

1 Answers1

2

Since Git for Windows 2.18 mentions

The diff filter for .pdf files was fixed.

It stands to reason that 2.17 included a diff filter in place for pdf.
You can see its setting in git-for-windows/build-extra/.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250