def tracked_files(*args): """Return the names of all files in the repository""" out = git.ls_files('--', *args, z=True)[STDOUT] if out: return sorted(out[:-1].split('\0')) else: return []
def diff_worktree(paths=None): modified = [] submodules = set() if paths is None: paths = [] filter_paths = ['--'] + paths status, out, err = git.diff_files(z=True, *filter_paths) if status != 0: # handle git init out = git.ls_files(modified=True, z=True)[STDOUT] if out: modified = out[:-1].split('\0') return modified, 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': modified.append(name) return modified, submodules
def all_files(): """Return the names of all files in the repository""" out = git.ls_files(z=True)[STDOUT] if out: return out[:-1].split('\0') else: return []
def all_files(): """Returns a sorted list of all files, including untracked files.""" ls_files = git.ls_files(z=True, cached=True, others=True, exclude_standard=True)[STDOUT] return sorted([f for f in ls_files.split('\0') if f])
def all_files(): """Return the names of all files in the repository""" ls_files = git.ls_files(z=True) if ls_files: return core.decode(ls_files[:-1]).split('\0') else: return []
def all_files(): """Return the names of all files in the repository""" out = git.ls_files(z=True)[STDOUT] if out: return out[:-1].split("\0") else: return []
def untracked_files(git=git, paths=None): """Returns a sorted list of untracked files.""" if paths is None: paths = [] args = ['--'] + paths out = git.ls_files(z=True, others=True, exclude_standard=True, *args)[STDOUT] if out: return out[:-1].split('\0') return []
def diff_worktree(): modified = [] submodules = set() status, out, err = git.diff_files(z=True) if status != 0: # handle git init out = git.ls_files(modified=True, z=True)[STDOUT] if out: modified = out[:-1].split("\0") return modified, 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": modified.append(name) return modified, submodules
def diff_worktree(): modified = [] submodules = set() status, output = git.diff_files(z=True, with_status=True) if status != 0: # handle git init ls_files = core.decode(git.ls_files(modified=True, z=True)) if ls_files: modified = ls_files[:-1].split('\0') return modified, submodules while output: rest, output = output.split('\0', 1) name, output = output.split('\0', 1) status = rest[-1] name = core.decode(name) if '160000' in rest[1:14]: submodules.add(name) elif status in 'DAMT': modified.append(name) return modified, submodules
def diff_worktree(): modified = [] submodules = set() output = git.diff_files(z=True, with_stderr=True) if output.startswith("fatal:"): # handle git init ls_files = core.decode(git.ls_files(modified=True, z=True)) if ls_files: modified = ls_files[:-1].split("\0") return modified, submodules while output: rest, output = output.split("\0", 1) name, output = output.split("\0", 1) status = rest[-1] name = core.decode(name) if "160000" in rest[1:14]: submodules.add(name) elif status in "DAMT": modified.append(name) return modified, submodules
def untracked_files(git=git): """Returns a sorted list of untracked files.""" ls_files = git.ls_files(z=True, others=True, exclude_standard=True) if ls_files: return core.decode(ls_files[:-1]).split('\0') return []
def untracked_files(git=git): """Returns a sorted list of untracked files.""" out = git.ls_files(z=True, others=True, exclude_standard=True)[STDOUT] if out: return out[:-1].split("\0") return []
def untracked_files(git=git): """Returns a sorted list of untracked files.""" out = git.ls_files(z=True, others=True, exclude_standard=True)[STDOUT] if out: return out[:-1].split('\0') return []