def diff_index(head, cached=True, paths=None): staged = [] unmerged = [] deleted = set() submodules = set() if paths is None: paths = [] args = [head, '--'] + paths status, out, err = git.diff_index(cached=cached, z=True, *args) if status != 0: # handle git init args[0] = EMPTY_TREE_SHA1 status, out, err = git.diff_index(cached=cached, z=True, *args) for path, status, is_submodule in _parse_raw_diff(out): if is_submodule: submodules.add(path) if status in 'DAMT': staged.append(path) if status == 'D': deleted.add(path) elif status == 'U': unmerged.append(path) return staged, unmerged, deleted, submodules
def diff_index(head, cached=True): decode = core.decode submodules = set() staged = [] unmerged = [] status, output = git.diff_index(head, 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
def diff_index(head, cached=True, paths=None): submodules = set() staged = [] unmerged = [] if paths is None: paths = [] filter_paths = [head, '--'] + paths status, out, err = git.diff_index(cached=cached, z=True, *filter_paths) if status != 0: # handle git init return all_files(), unmerged, submodules while out: rest, out = out.split('\0', 1) name, out = out.split('\0', 1) status = rest[-1] 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
def diff_index(head, cached=True): decode = core.decode submodules = set() staged = [] unmerged = [] status, output = git.diff_index(head, '--', 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
def diff_index(head, cached=True, paths=None): submodules = set() staged = [] unmerged = [] if paths is None: paths = [] filter_paths = [head, '--'] + paths status, out, err = git.diff_index(cached=cached, z=True, *filter_paths) if status != 0: # handle git init return tracked_files(), unmerged, submodules while out: rest, out = out.split('\0', 1) name, out = out.split('\0', 1) status = rest[-1] 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
def diff_index(head, cached=True): submodules = set() staged = [] unmerged = [] status, out, err = git.diff_index(head, "--", cached=cached, z=True) if status != 0: # handle git init return all_files(), unmerged, submodules while out: rest, out = out.split("\0", 1) name, out = out.split("\0", 1) status = rest[-1] 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
def diff_index(head): decode = core.decode submodules = set() staged = [] unmerged = [] output = git.diff_index(head, z=True, cached=True, with_stderr=True) if output.startswith("fatal:"): # 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
def diff_index_filenames(ref): """Return a of filenames that have been modified relative to the index""" out = git.diff_index(ref, name_only=True, z=True)[STDOUT] return _parse_diff_filenames(out)
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)