社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

为什么我的git突然神奇地能够显示pdf文件的文本差异?

ahiijny • 4 年前 • 965 次点击  

我有Git版本 2.17.0.windows.1 在我的Windows10计算机上。据我所知,git不应该能够对pdf文件进行开箱即用的区分。我一直希望diff消息只是说“二进制文件a.pdf和b.pdf不同”。

因此,我很惊讶地看到控制台有一天在一个存储库中用一个更新过的pdf文件打印出来:

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

我知道有一种方法可以显示人类的可读性 diffs for binary files 在gitconfig中使用textconv设置,在gittattributes中为特定的文件扩展名使用diff属性,但我当然没有为我的计算机做过类似的事情。我只是使用exe安装程序安装git,从那时起我就没有真正更改过任何配置设置。

这是什么 git config --list 显示在该文件夹中的时间:

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

我最初以为这是最近添加到git中的一些新功能,但是当我在一台ubuntu 16.04的git版本的机器上尝试diff时 2.19.0 ,这是控制台输出的内容:

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

所以…看起来不像吗?

那么,这种神奇的独角兽pdf差异行为是从哪里来的呢?这是在哪里配置的?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/40799
 
965 次点击  
文章 [ 1 ]  |  最新文章 4 年前
VonC
Reply   •   1 楼
VonC    5 年前

自从 Git for Windows 2.18 提到

已修复.pdf文件的diff筛选器。

毫无疑问,2.17包含了一个pdf格式的diff过滤器。
你可以看到它的背景 git-for-windows/build-extra/ .