相关疑难解决方法(0)

如何处理未跟踪的文件并提高 git status 性能

我目前在 Mac 上。

\n

在 Git 2.35.1 中,当我克隆存储库时,需要 7 秒来枚举未跟踪的文件,而当我这样做时time git status,大约需要 2 秒。\n而且,当我签出到其他分支时,大约需要 15 秒,而当我签出时,大约需要 15 秒。返回我的主仓库git status花了 15 秒(不应该花这么多时间)。

\n

(2.35.1) 中的解决方法是:\n我设置core.untrackedCache=trueGIT_FORCE_UNTRACKED_CACHE=1\n这有助于更新未跟踪的缓存并提高git status大多数 Stack Overflow 答案中提到的性能(大约 4 秒)。\n stack-溢出问题

\n

但现在在 Git 2.36.1 中,这种解决方法似乎不起作用。所有分支大约需要 20 秒。

\n

代码中可能的更改:

\n

在 Git 2.35.1 中,代码如下dir.c

\n
if (dir->untracked) {\n        static int force_untracked_cache = -1;\n\n        if (force_untracked_cache < 0)\n            force_untracked_cache =\n                git_env_bool("GIT_FORCE_UNTRACKED_CACHE", 0);\n        if (force_untracked_cache &&\n            dir->untracked …
Run Code Online (Sandbox Code Playgroud)

git git-config

5
推荐指数
1
解决办法
1194
查看次数

标签 统计

git ×1

git-config ×1