Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Simple caching to keep editor responsive over slow network connections #152
Implements a simple caching mechanism for git_root() to keep the editor responsive when editing files over slow network connections (over an SSH mount, for example).
git_root() is called for each command and may stat several directories on each call. On a slow network connection, the editor can become completely unresponsive for long periods.
These changes cache the result for a single call to git_root() for 5 seconds. The effect is that git_root() only traverses the directory tree for a given leaf directory once whenever Sublime needs to check if all of the commands are active (instead of 38 times).
The cache time is kept short to allow for realtime changes in git_root()'s results (if the user creates a repo, for example).