Created by: rhencke
When running Buck from a dirty working copy, a large amount of startup time was spent calculating the version in get_dirty_buck_version. git read-tree was reading a fresh index into a temporary file, which contained no stat() information about the working copy's current stat. When git add -u then ran, it then had to rebuild this information for all tracked files, which was time-consuming.
The new version re-uses the current index's stat() information when writing the index to a temporary file. It also shaves off one call to git, taking advantage of the fact that HEAD counts as a tree-ish object that can be passed to git read-tree.