Walk a tree and return a sequence of (directory, dotdir) pairs.

def find_repositories_by_walking_without_following_symlinks(path):
    """Walk a tree and return a sequence of (directory, dotdir) pairs."""
    repos = []
    for dirpath, dirnames, filenames in os.walk(path, followlinks=False):
        for dotdir in set(dirnames) & DOTDIRS:
            repos.append((dirpath, dotdir))
    return repos