gpt4 book ai didi

Git 桂 "No diffferences detected"

转载 作者:太空狗 更新时间:2023-10-29 14:16:23 30 4
gpt4 key购买 nike

我在 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 cause git-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 the autocrlf 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 to git 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 add --renormalize -- :/

关于Git 桂 "No diffferences detected",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57556917/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com