git status --ignored无限期挂起 [英] git status --ignored hangs indefinitely

查看:119
本文介绍了git status --ignored无限期挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tl; dr :在项目根目录中运行git status --ignored永远不会完成. git status正常.

tl;dr: Running git status --ignored in the root of my project never finishes. git status works fine.

我开始从我的IDE-PhpStorm中看到此问题的症状(尽管此问题适用于所有IntelliJ IDE).没有与git相关的操作(提交,推送,获取),所有这些操作都会无休止地挂起.查看正在运行的进程,结果发现有一个git进程占用了100%的CPU.

I started seeing the symptoms of this issue from my IDE - PhpStorm (though this issue would apply to all IntelliJ IDEs). No git-related operations (commit, push, fetch) work, all of them would hang endlessly. Looking at the running processes, turns out there was a git process taking 100% CPU.

杀死git进程使IDE再次平稳运行了几分钟.似乎周期性地产生了同步变更的过程.稍后进行一些实验,结果证明这不是PhpStorm的问题,而是git的问题. git status --ignored即使从命令行执行,也永远不会完成.

Killing the git processes made the IDE run smoothly again for a couple of minutes. Seems like it periodically spawns the process to sync up changes. Some experimenting later, turns out this is not an issue of PhpStorm, but of git. git status --ignored never finishes even when executed from the command line.

推荐答案

就我而言,罪魁祸首是项目路径中的深层目录结构.它一定是由 something 在我们没有注意到的工具堆栈中生成的,因为它的深度超过100个目录,那里没有实际的文件.

In my case, the culprit was a deep directory structure in the project path. It must have been generated by something in our tool stack I didn't notice, because it was over 100 directories deep, with no actual files present there.

cp拒绝复制此目录,称name too long (not copied).我猜git会以某种方式跳入这样的目录.

cp refused to copy this directory, saying name too long (not copied). I'm guessing git somehow trips up on directories like this.

删除深度嵌套的目录层次结构可以解决此问题,并且git status --ignored现在可以按预期运行.

Deleting the deeply nested dir hierarchy fixed the issue for me and git status --ignored works as expected now.

已确认这是git中的错误.从邮件列表中摘录:

this was confirmed to be a bug in git. Exerpt from the mailing list:

没有这样的目录深度限制,但是'git status的运行时 --ignored'随未跟踪目录的深度而迅速增长. 运行此Shell循环将产生以下数字:

There is no such directory depth limit, but the runtime of 'git status --ignored' grows quickly with the depth of the untracked directory. Running this shell loop produces the numbers below:

10: 0.01
11: 0.03
12: 0.05
13: 0.11
14: 0.23
15: 0.47
16: 0.97
17: 1.97
18: 3.88
19: 7.85
20: 16.29
21: 32.92
22: 76.24

精美二次方,不是吗? :)

Beautifully quadratic, isn't it? :)

除非我弄乱了号码,深度为120, 需要超过6 * 10 ^ 23年才能完成...所以是的,它确实符合条件 无限期地.

Unless I messed up my numbers, with a depth of 120 directories it would take over 6*10^23 years to complete... so yeah, it does qualify as indefinitely.

这篇关于git status --ignored无限期挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆