def ensure_untracked(self, path): """Ensure that path is not part of git untracked files.""" untracked = self.repo.untracked_files for file_path in untracked: is_parent = str(file_path).startswith(path) is_equal = path == file_path if is_parent or is_equal: raise errors.DirtyRenkuDirectory(self.repo)
def ensure_unstaged(self, path): """Ensure that path is not part of git staged files.""" try: staged = self.repo.index.diff('HEAD') for file_path in staged: is_parent = str(file_path.a_path).startswith(path) is_equal = path == file_path.a_path if is_parent or is_equal: raise errors.DirtyRenkuDirectory(self.repo) except gitdb.exc.BadName: pass