You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let me describe the same issue for me.
When libgit2 tries to get status of files (modified or not), library compares mtime/ctime flags from index to folder's attributes. If folder is modified, then libgit2 searches the contents of each file/folder in modified folder to figure out if file was modified or not. I don't know why, but on some machines folder attributes always diff from information written in git index. That forces library to watch every file in repository.
So, many files in repository slows down performance of RetrieveStatus.
One of our company computer calls RetrieveStatus for 40 seconds. On another computers that tooks only 3-4 seconds.
On "bad" computer there only records like at screenshot. All files in repository was opened.
I compared the output of git ls-files --debug between two computers and saw that there were differences in mtime flag. I tried to understand what mtime means. mtime is the "modified time", right?
I opened libgit2 source code and found that if comment mtime check, that fixes slow performance on "bad" computer:
Well, here's what I'm trying to understand: if the mtime is different from the cache, yes, libgit2 (and git) will inspect the file to determine if it's changed. So after cloning, something is touching that filestamp on disk so that it doesn't match the cache. Any idea what's doing that?
Activity
ethomson commentedon Apr 20, 2018
Does
git statustake a long time? What aboutgit status --ignored?sumayn commentedon Apr 20, 2018
so fast do
git statusorgit status --ignoredbut use libgit2sharp api
_repo.RetrieveStatus(new StatusOptions())so slowlySnegovikufa commentedon Jun 5, 2018
Let me describe the same issue for me.
When libgit2 tries to get status of files (modified or not), library compares mtime/ctime flags from index to folder's attributes. If folder is modified, then libgit2 searches the contents of each file/folder in modified folder to figure out if file was modified or not. I don't know why, but on some machines folder attributes always diff from information written in git index. That forces library to watch every file in repository.
So, many files in repository slows down performance of
RetrieveStatus.One of our company computer calls
RetrieveStatusfor 40 seconds. On another computers that tooks only 3-4 seconds.ethomson commentedon Jun 5, 2018
What version of git? Are you sure the mtime and ctime in the index match the filesystem? In particular the high resolution bits?
Snegovikufa commentedon Jun 5, 2018
That issue was not on my own computer. Git version is something like 2.10.
We started to monitor file system with Process Monitor (https://technet.microsoft.com/ru-ru/sysinternals/processmonitor.aspx).
On "bad" computer there only records like at screenshot. All files in repository was opened.

I compared the output of
git ls-files --debugbetween two computers and saw that there were differences in mtime flag. I tried to understand what mtime means. mtime is the "modified time", right?I opened libgit2 source code and found that if comment mtime check, that fixes slow performance on "bad" computer:
ethomson commentedon Jun 5, 2018
Are you copying this repository between two computers directly? Or sharing it on a network drive or something?
Snegovikufa commentedon Jun 5, 2018
We clone repository from remote TFS repository.
ethomson commentedon Jun 5, 2018
Well, here's what I'm trying to understand: if the mtime is different from the cache, yes, libgit2 (and git) will inspect the file to determine if it's changed. So after cloning, something is touching that filestamp on disk so that it doesn't match the cache. Any idea what's doing that?
Snegovikufa commentedon Jun 5, 2018
I had that idea too but I don't know what modifies timestamps on disk.
Is there any tool to synchronize git cache and timestamp on disk?
ethomson commentedon Jun 5, 2018
Yes.
git statuswill do that once it's determined that you haven't made any changes.Snegovikufa commentedon Jun 6, 2018
git status --debugon my machine:On "bad" machine git version is 2.8.1. I confused with
:0value in ctime and mtime. Also, I don't know what 'dev' meanskboom commentedon Jan 27, 2023
This is the same issue for me. Takes a very long time while
git statusis instant.PulsarFX commentedon Jul 12, 2024
Was there any solution for those who were affected in the past?
What is the C# code with all option flags to mimic
git status?