def find(search):
    refs = call('git for-each-ref --shell refs/')
    branches = []
    for ref in refs.splitlines():
        try:
            branch_name = ref.split('refs/heads/')[1][:-1]
        except IndexError:
            continue
        if search and search.lower() not in branch_name.lower():
            continue
        branches.append(branch_info(branch_name))
    return branches
dataset/ETHPy150Open peterbe/bgg/bgg/lib/branches.py/find/original