Git Status Takes a Long Time to Complete

后端 未结 13 721
一整个雨季
一整个雨季 2020-12-12 20:32

I\'m using git to manage files in a local directory on a Windows machine - no network is involved here, I\'m not pushing or pulling to/from another machine. My

13条回答
  •  甜味超标
    2020-12-12 20:49

    Another aspect of git status which will be improved (in Git 2.14.x/2.15, Q4 2017) is when it shows ignored files as well (git status --ignored)

    "git status --ignored", when noticing that a directory without any tracked path is ignored, still enumerated all the ignored paths in the directory, which is unnecessary.
    The codepath has been optimized to avoid this overhead.

    See commit 5aaa7fd (18 Sep 2017) by Jameson Miller (jamill).
    (Merged by Junio C Hamano -- gitster -- in commit 075bc9c, 29 Sep 2017)

    Improve performance of git status --ignored

    Improve the performance of the directory listing logic when it wants to list non-empty ignored directories. In order to show non-empty ignored directories, the existing logic will recursively iterate through all contents of an ignored directory.
    This change introduces the optimization to stop iterating through the contents once it finds the first file. This can have a significant improvement in 'git status --ignored' performance in repositories with a large number of files in ignored directories.

    For an example of the performance difference on an example repository with 196,000 files in 400 ignored directories:

    | Command                    |  Time (s) |
    | -------------------------- | --------- |
    | git status                 |   1.2     |
    | git status --ignored (old) |   3.9     |
    | git status --ignored (new) |   1.4     |
    

    For more improvment (set in Git 2.17, Q2 2018), see this answer.

提交回复
热议问题