Dav*_*veW 8 windows git git-stash
尝试隐藏更改时,我遇到了一些奇怪的行为。我不是 git 专家,所以我希望有人能对此有所了解:
3 处的行为对我来说毫无意义。它最近开始发生。我已经使用 stash/stash pop 几个月了,没有任何问题。
我想知道我的本地工作副本是否有问题,所以我重新克隆但得到了相同的行为。
我的 GIT 安装坏了,还是我遗漏了什么?
附加信息:
在另一台 PC 上尝试过,它的行为符合预期,因此与此安装有关。
尝试创建一个新的本地存储库,添加并提交 1 个文件,修改,存储。相同的行为
尝试使用 CR LF 和 LF 行结尾的文件。相同的行为
git 配置 -l:
core.symlinks=true
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor='C:\Program Files (x86)\Notepad++\notepad++.exe' -multiInst - notabbar -nosession -noPlugin
core.excludesfile=C:\GIT\gitignore\VisualStudio.gitignore
core.editor=notepad
core.fscache=true
core.preloadindex=true
gui.fontdiff=-family Consolas -size 10 -weight normal -slant roman - underline 0 -overstrike 0
gui.recentrepo=C:/GIT/polarisv4
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.name=xxxxx
user.email=xxxxxx
difftool.sourcetree.cmd='C:/Program Files/TortoiseGit/bin/TortoiseGitMerge.exe' "$LOCAL" "$REMOTE"
mergetool.sourcetree.cmd='C:/Program Files/TortoiseGit/bin/TortoiseGitMerge.exe' -base:"$BASE" -mine:"$LOCAL" - theirs:"$REMOTE" -merged:"$MERGED"
mergetool.sourcetree.trustexitcode=true
alias.co=checkout
alias.br=branch
alias.st=status
winupdater.recentlyseenversion=2.15.1.windows.2
credential.helper=manager
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
Run Code Online (Sandbox Code Playgroud)
正如 DaveW 所说,问题出在core.fscache=true设置上。这是仅限 Windows 的设置,可启用文件系统缓存以缓解某些 Windows 文件系统操作的缓慢情况。以下是从提交消息Win32: add a cache under mingw's lstat and dirent Implements 中提取的描述:
由于 lstat 模拟速度慢(git 对索引中的每个文件调用一次 lstat),在 Windows 上检查工作树状态相当慢。Windows 操作系统 API 似乎更擅长扫描整个目录的状态,而不是检查单个文件。
添加一个使用 lstat 数据缓存的 lstat 实现。缓存未命中会读取整个父目录并将其添加到缓存中。对同一目录的后续 lstat 调用直接从缓存提供服务。
还实现 opendir / readdir / closeir ,以便它们在缓存中创建和使用目录列表。
缓存不会跟踪文件系统更改,也不会插入任何修改文件 API,因此必须为不修改工作副本的 git 函数显式启用它。
该提交消息的最后一句指出了 OP 问题的原因。