public static function getRevision($length = 10)
    {
        $revision = Cache::call("revision", function() {
            $path = static::path(".git");
            if (!is_dir($path)) {
                return;
            }

            $head = $path . "/HEAD";
            if (!file_exists($head)) {
                return;
            }

            $data = File::getContents($head);
            if (!preg_match("/ref: ([^\s]+)\s/", $data, $matches)) {
                return;
            }
            $ref = $path . "/" . $matches[1];
            if (!file_exists($ref)) {
                return;
            }

            return File::getContents($ref);
        });

        if ($length > 0) {
            return substr($revision, 0, $length);
        } else {
            return $revision;
        }
    }