Ejemplo n.º 1
0
def specified_diff_index(head, p, cached=True):
    decode = core.decode
    submodules = set()
    staged = []
    unmerged = []

    status, output = git.diff_index(head, p, cached=cached,
                                    z=True, with_status=True)
    if status != 0:
        # handle git init
        return all_files(), unmerged, submodules

    while output:
        rest, output = output.split('\0', 1)
        name, output = output.split('\0', 1)
        status = rest[-1]
        name = decode(name)
        if '160000' in rest[1:14]:
            submodules.add(name)
        elif status  in 'DAMT':
            staged.append(name)
        elif status == 'U':
            unmerged.append(name)

    return staged, unmerged, submodules
Ejemplo n.º 2
0
def diff_index_filenames(ref):
    """Return a of filenames that have been modified relative to the index"""
    diff_zstr = git.diff_index(ref, name_only=True, z=True)
    return _parse_diff_filenames(diff_zstr)