def is_git_dir(d):
    """ This is taken from the git setup.c:is_git_directory
    function.

    @throws WorkTreeRepositoryUnsupported if it sees a worktree directory. It's quite hacky to do that here,
            but at least clearly indicates that we don't support it.
            There is the unlikely danger to throw if we see directories which just look like a worktree dir,
            but are none."""
    if isdir(d):
        if isdir(join(d, 'objects')) or isdir(join(d, 'refs')):
            headref = join(d, 'HEAD')
            return isfile(headref) or \
                (os.path.islink(headref) and
                 os.readlink(headref).startswith('refs'))
        elif isfile(join(d, 'gitdir')) and isfile(join(d, 'commondir')) and isfile(join(d, 'gitfile')):
            raise WorkTreeRepositoryUnsupported(d)
    return False
dataset/ETHPy150Open gitpython-developers/GitPython/git/repo/fun.py/is_git_dir/operator `and` -> `or`