def is_git_dir(d):
    """ This is taken from the git setup.c:is_git_directory. """
    isdir = os.path.isdir
    join = os.path.join
    isfile = os.path.isfile
    islink = os.path.islink
    if isdir(d) or isdir(join(d, 'objects')) and isdir(join(d, 'refs')):
        headref = join(d, 'HEAD')
        return isfile(headref) or (islink(headref) and
                                   os.readlink(headref).startswith('refs'))
    return False
dataset/ETHPy150Open douban/ellen/ellen/repo.py/is_git_dir/operator `and` -> `or`