kemayo/sublime-text-2-git — pull request #152 by jotson (2012-06-30 21:44:52+00:00)
Title: Simple caching to keep editor responsive over slow network connections

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).