GIT 警告:跳过不准确重命名检测的文件太多

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5181322/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:15:19  来源:igfitidea点击:

GIT warning: too many files skipping inexact rename detection

gitgit-mergegit-config

提问by Senthil A Kumar

Am aware that the the default rename limit is 100 and can increase this value using the config "diff.renamelimit config"

我知道默认的重命名限制是 100,可以使用配置“diff.renamelimit config”增加这个值

What am worried is, if this config is not setup, will there be a wrong merge, any missing code? Am trying to merge (git merge) 2 branches that has huge changes.

我担心的是,如果没有设置这个配置,会不会有错误的合并,任何丢失的代码?我正在尝试合并(git merge)2个有巨大变化的分支。

Can someone throw more light about this config setting?

有人可以更详细地了解此配置设置吗?

采纳答案by Hank Gay

Your content is safe.

您的内容是安全的。

As I understand it, gitdoesn't actually have any concept of a first-class renameoperation (only bzrdoes, of the big 3 DVCSs): the mvis sugar on top of the underlying machinery, which is basically an addand a rm. Since gitcan track the content that changes during such operations, though, it can use heuristics to guess when an addand a rmare actually a mv. Since that takes way more work than just displaying what gitactually recorded—the docs for git-diffexplain that it "...require O(n^2) processing time where n is the number of potential rename/copy targets"—gitwon't try it when too many files are involved. The setting you mention just controls that threshold.

据我了解,git实际上并没有任何一流rename操作的概念(只有bzr3 大 DVCS):mv底层机器上的糖,基本上是一个add和一个rm。但是,由于git可以跟踪在此类操作期间更改的内容,因此它可以使用启发式方法来猜测 anadd和 a何时rm实际上是 a mv。由于这需要做更多的工作,而不仅仅是显示git实际记录的内容——git-diff解释它的文档“...需要 O(n^2) 处理时间,其中 n 是潜在的重命名/复制目标的数量”——git不会尝试当涉及太多文件时。您提到的设置仅控制该阈值。

回答by M3RS

In case this helps anyone, I had a lot of files (hundreds, if not thousands) in one branch, which were not yet in the other branch. Running

如果这对任何人有帮助,我在一个分支中有很多文件(数百个,如果不是数千个),而另一个分支中还没有。跑步

$ git config merge.renamelimit 15345

made the below error when merging go away

合并时出现以下错误消失

$ git merge master
.
.
.
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 15345 and retry the command.