Windows10 GitBash在提交时挂起约五分钟:这正常吗?

mitkmikd  于 2022-12-17  发布在  Git
关注(0)|答案(1)|浏览(142)

我的GitBash版本是2.36.1
我的Mintty的版本是3.6.1(x86_64-pc-msys)[Windows 19044]
我的GitBash的Mintty终端在运行以下代码时挂起了大约5分钟:

<user> <path> (master)
$ git add .

<user> <path> (master)
$ git commit -m "..."
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Enumerating objects: 384, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 4 threads
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), done.
Total 17 (delta 4), reused 0 (delta 0), pack-reused 0
Removing duplicate objects: 100% (256/256), done.

在这里挂了大约五分钟。
它以前从未这样做过。
这通常是可能的,还是我可能做错了什么(如果是,纠正什么和如何纠正)?
编辑:.git文件夹的钩子:

EDIT 3:删除了EDIT 2,它在“git status”命令下显示trace 2日志,在EDIT 3中,我在最新的“git commit”命令下发布trace 2日志:

commit -m <my message>
d0 | main                     | data_json    | r0  |  0.036147 |  0.036147 | process      | windows/ancestry:["bash.exe","bash.exe"]
d0 | main                     | def_repo     | r1  |           |           |              | worktree:'<my path>'
d0 | main                     | cmd_name     |     |           |           |              | commit (commit)
d0 | main                     | region_enter | r1  |  0.112412 |           | index        | label:do_read_index .git/index
d0 | main                     | region_enter | r1  |  0.114001 |           | cache_tree   | ..label:read
d0 | main                     | region_leave | r1  |  0.114116 |  0.000115 | cache_tree   | ..label:read
d0 | main                     | data         | r1  |  0.114183 |  0.001771 | index        | ..read/version:2
d0 | main                     | data         | r1  |  0.114214 |  0.001802 | index        | ..read/cache_nr:401
d0 | main                     | region_leave | r1  |  0.114240 |  0.001828 | index        | label:do_read_index .git/index
d0 | main                     | region_enter |     |  0.115291 |           | index        | label:refresh
d0 | main                     | data         |     |  0.118960 |  0.003669 | index        | ..refresh/sum_lstat:401
d0 | main                     | data         |     |  0.119016 |  0.003725 | index        | ..refresh/sum_scan:0
d0 | main                     | region_leave |     |  0.119039 |  0.003748 | index        | label:refresh
d0 | main                     | region_enter | r1  |  0.226613 |           | unpack_trees | label:unpack_trees
d0 | main                     | region_enter | r1  |  0.227008 |           | unpack_trees | ..label:traverse_trees
d0 | main                     | region_leave | r1  |  0.227473 |  0.000465 | unpack_trees | ..label:traverse_trees
d0 | main                     | region_leave | r1  |  0.228410 |  0.001797 | unpack_trees | label:unpack_trees
d0 | main                     | region_enter | r1  |  0.228996 |           | diff         | label:setup
d0 | main                     | region_leave | r1  |  0.229037 |  0.000041 | diff         | label:setup
d0 | main                     | region_enter | r1  |  0.229053 |           | diff         | label:write back to queue
d0 | main                     | region_leave | r1  |  0.229067 |  0.000014 | diff         | label:write back to queue
d0 | main                     | region_enter | r1  |  0.254939 |           | status       | label:worktrees
d0 | main                     | region_enter | r1  |  0.255650 |           | diff         | ..label:setup
d0 | main                     | region_leave | r1  |  0.255705 |  0.000055 | diff         | ..label:setup
d0 | main                     | region_enter | r1  |  0.255731 |           | diff         | ..label:write back to queue
d0 | main                     | region_leave | r1  |  0.255752 |  0.000021 | diff         | ..label:write back to queue
d0 | main                     | region_leave | r1  |  0.255774 |  0.000835 | status       | label:worktrees
d0 | main                     | region_enter | r1  |  0.255795 |           | status       | label:index
d0 | main                     | region_enter | r1  |  0.256585 |           | unpack_trees | ..label:unpack_trees
d0 | main                     | region_enter | r1  |  0.256929 |           | unpack_trees | ....label:traverse_trees
d0 | main                     | region_leave | r1  |  0.256993 |  0.000064 | unpack_trees | ....label:traverse_trees
d0 | main                     | region_leave | r1  |  0.257023 |  0.000438 | unpack_trees | ..label:unpack_trees
d0 | main                     | region_enter | r1  |  0.257040 |           | diff         | ..label:setup
d0 | main                     | region_leave | r1  |  0.257053 |  0.000013 | diff         | ..label:setup
d0 | main                     | region_enter | r1  |  0.257066 |           | diff         | ..label:write back to queue
d0 | main                     | region_leave | r1  |  0.257079 |  0.000013 | diff         | ..label:write back to queue
d0 | main                     | region_leave | r1  |  0.257093 |  0.001298 | status       | label:index
d0 | main                     | region_enter | r1  |  0.257114 |           | status       | label:untracked
d0 | main                     | region_enter | r1  |  0.257441 |           | dir          | ..label:read_directory
d0 | main                     | region_enter | r1  |  0.257591 |           | index        | ....label:name-hash-init
d0 | main                     | region_leave | r1  |  0.257678 |  0.000087 | index        | ....label:name-hash-init
d0 | main                     | data         | r1  |  0.259703 |  0.002262 | read_directo | ....path:
d0 | main                     | data         | r1  |  0.259737 |  0.002296 | read_directo | ....directories-visited:29
d0 | main                     | data         | r1  |  0.259753 |  0.002312 | read_directo | ....paths-visited:454
d0 | main                     | region_leave | r1  |  0.259766 |  0.002325 | dir          | ..label:read_directory
d0 | main                     | region_leave | r1  |  0.259782 |  0.002668 | status       | label:untracked
d0 | main                     | data         | r1  |  0.260047 |  0.260047 | status       | count/changed:0
d0 | main                     | data         | r1  |  0.260069 |  0.260069 | status       | count/untracked:0
d0 | main                     | data         | r1  |  0.260083 |  0.260083 | status       | count/ignored:0
d0 | main                     | region_enter | r1  |  0.260096 |           | status       | label:print
d0 | main                     | region_leave | r1  |  0.262113 |  0.002017 | status       | label:print
d0 | main                     | data         | r1  |  0.262167 |  0.262167 | fsync        | fsync/writeout-only:0
d0 | main                     | data         | r1  |  0.262183 |  0.262183 | fsync        | fsync/hardware-flush:0
d0 | main                     | data_json    | r1  |  0.262521 |  0.262521 | process      | windows/memory:{"PageFaultCount":5233,"PeakWorkingSetSize":9674752,"PeakPagefileUsage":7364608}
d0 | main                     | exit         |     |  0.262553 |           |              | code:1
d0 | main                     | data_json    | r1  |  0.262570 |  0.262570 | traverse_tre | statistics:{"traverse_trees_count":2,"traverse_trees_max_depth":1}
d0 | main                     | atexit       |     |  0.262588 |           |              | code:1
d0 | main                     | version      |     |           |           |              | 2.36.1.windows.1
d0 | main                     | start        |     |  0.012317 |           |              | 'C:\Program Files\Git\mingw64\bin\git.exe' rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
d0 | main                     | data_json    | r0  |  0.052169 |  0.052169 | process      | windows/ancestry:["bash.exe","bash.exe","bash.exe","bash.exe"]
d0 | main                     | cmd_name     |     |           |           |              | rev-parse (rev-parse)
d0 | main                     | def_repo     | r1  |           |           |              | worktree:'<my path>'
d0 | main                     | data         | r1  |  0.065587 |  0.065587 | fsync        | fsync/writeout-only:0
d0 | main                     | data         | r1  |  0.065763 |  0.065763 | fsync        | fsync/hardware-flush:0
d0 | main                     | data_json    | r1  |  0.066035 |  0.066035 | process      | windows/memory:{"PageFaultCount":5960,"PeakWorkingSetSize":7704576,"PeakPagefileUsage":5218304}
d0 | main                     | exit         |     |  0.066077 |           |              | code:0
d0 | main                     | atexit       |     |  0.066102 |           |              | code:0
d0 | main                     | version      |     |           |           |              | 2.36.1.windows.1
d0 | main                     | start        |     |  0.011809 |           |              | 'C:\Program Files\Git\mingw64\bin\git.exe' config --bool core.sparseCheckout
d0 | main                     | data_json    | r0  |  0.053999 |  0.053999 | process      | windows/ancestry:["bash.exe","bash.exe","bash.exe","bash.exe"]
d0 | main                     | def_repo     | r1  |           |           |              | worktree:'<my path>'
d0 | main                     | cmd_name     |     |           |           |              | config (config)
d0 | main                     | data         | r1  |  0.058257 |  0.058257 | fsync        | fsync/writeout-only:0
d0 | main                     | data         | r1  |  0.058297 |  0.058297 | fsync        | fsync/hardware-flush:0
d0 | main                     | data_json    | r1  |  0.058552 |  0.058552 | process      | windows/memory:{"PageFaultCount":5874,"PeakWorkingSetSize":7675904,"PeakPagefileUsage":3547136}
d0 | main                     | exit         |     |  0.058593 |           |              | code:1
d0 | main                     | atexit       |     |  0.058619 |           |              | code:1
d0 | main                     | version      |     |           |           |              | 2.36.1.windows.1
d0 | main                     | start        |     |  0.012306 |           |              | 'C:\Program Files\Git\mingw64\bin\git.exe'

有什么异常吗?谢谢!

pbpqsu0x

pbpqsu0x1#

这可能是完全正常的。线索就在这一行(以及它后面的内容):

Auto packing the repository in background for optimum performance.

正如this答案中很好地描述的那样,一些Git命令(包括git commitsince Git 2.17)调用git gc --auto。当有足够的松散对象时(当你使用git时,这会随着时间的推移而积累),这个命令会开始打包这些松散对象。这样做是为了不时地进行一些轻量级的垃圾收集(也可以参见git-scm文档)。
所需的时间取决于您最近执行了哪些操作,以及git repo中有哪些类型的对象。
我会说:让打包工作正常完成,不要太担心。完成打包后,你应该可以像以前一样使用Git了。这种自动垃圾回收只是偶尔发生的。
希望这对你有帮助!

相关问题