- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在 Git 中有一个存储库,其中大量文件被标记为正在被 Git Gui 编辑,当我单击其中一个文件时会出现一个对话框,其中包含:
"No differences detected.
filename.h has no changes.
The modification date of this file was updated by another
application, but the context within the file has not changed.
A rescan will be automatically started to find other files which
may have the stame state."
如果我单击“确定”按钮,应用程序会重新扫描并显示完全相同的结果,该结果会出现无限循环,因为具有这种情况的任何文件都会出现相同的对话框。
有什么方法可以通过忽略空白从扫描件中自动删除这些内容吗?
最佳答案
首先检查您的 git config --global core.autocrlf
是否设置为 false。
如果不是(或如果为空),将其设置为 false,再次克隆您的 Git 存储库,并检查 Git GUI 是否持续进行评估。
消息本身来自“git-gui/lib/diff.tcl#handle_empty_diff”,其blame view显示 10 年以上的代码。
具有讽刺意味的是,有一个名为“git-gui
: Avoid an infinite rescan loop in handle_empty_diff
.”的提交(commit 584fa9c)
If the index update machinery and
git diff
happen to disagree on whether a particular file is modified, it may causegit-gui
to enter an infinite index rescan loop, where an empty diff starts a rescan, which finds the same set of files modified, and tries to display the diff for the first one, which happensto be the empty one.
A current example of a possible disagreement point is theautocrlf
filter.
This patch breaks the loop by using a global counter to track the auto-rescans. The variable is reset whenever a non-empty diff is displayed.
Another suggested approach, which is based on giving the
--exit-code
argument togit diff
, cannot be used, because diff-files seems to trust the timestamps in the index, and returns a non-zero code even if the file is actually unchanged, which essentially defeats the purpose of the auto-rescan logic.
关于Git 桂 "No diffferences detected",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57556917/
我是一名优秀的程序员,十分优秀!