

def git_root(directory):
    global git_root_cache
    retval = False
    leaf_dir = directory
    if ((leaf_dir in git_root_cache) and (git_root_cache[leaf_dir]['expires'] > time.time())):
        return git_root_cache[leaf_dir]['retval']
    while directory:
        if os.path.exists(os.path.join(directory, '.git')):
            retval = directory
            break
        parent = os.path.realpath(os.path.join(directory, os.path.pardir))
        if (parent == leaf_dir):
            retval = False
            break
        directory = parent
    git_root_cache[leaf_dir] = {
        'retval': retval,
        'expires': (time.time() + 5),
    }
    return retval

dataset/ETHPy150Open JT5D/Alfred-Popclip-Sublime/Sublime Text 2/sublime-github/lib/git.py git_root/VarMisuse@119/146 `directory`->`leaf_dir`