def get_results(repos_dir, settings): paths = [] collect_only_dirty = settings.get('dirty', False) show_full_path = settings.get('full_path', False) for path, dirs, files in os.walk(repos_dir): if is_git_dir(path): repo = Repo(path) path = os.path.dirname(path) if show_full_path: path = PATH.format(heading=os.path.join(repos_dir, path)) else: path = PATH.format(heading=os.path.relpath(path, repos_dir)) bare = repo.bare dirty = repo.is_dirty() if (collect_only_dirty and dirty) or (not collect_only_dirty): paths.append({'path': path, 'bare': bare, 'dirty': dirty}) return paths