How to use the autohooks.api.git.Status function in autohooks

To help you get started, we’ve selected a few autohooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github greenbone / autohooks / autohooks / api / git.py View on Github external
def _parse_status(output):
    output = output.rstrip('\0')
    if not output:
        return

    output = output.split('\0')
    while output:
        line = output.pop(0)
        if line[0] == Status.RENAMED.value:
            yield '{}\0{}'.format(line, output.pop(0))
        else:
            yield line
github greenbone / autohooks / autohooks / api / git.py View on Github external
def __init__(self, status_string, root_path=None):
        status = status_string[:2]
        filename = status_string[3:]

        self.index = Status(status[0])
        self.working_tree = Status(status[1])
        self.root_path = root_path

        if self.index == Status.RENAMED:
            new_filename, old_filename = filename.split('\0')
            self.path = Path(new_filename)
            self.old_path = Path(old_filename)
        else:
            self.path = Path(filename)
github greenbone / autohooks / autohooks / api / git.py View on Github external
def __init__(self, status_string, root_path=None):
        status = status_string[:2]
        filename = status_string[3:]

        self.index = Status(status[0])
        self.working_tree = Status(status[1])
        self.root_path = root_path

        if self.index == Status.RENAMED:
            new_filename, old_filename = filename.split('\0')
            self.path = Path(new_filename)
            self.old_path = Path(old_filename)
        else:
            self.path = Path(filename)
github greenbone / autohooks / autohooks / api / git.py View on Github external
def is_staged_status(status):
    return (
        status.index != Status.UNMODIFIED
        and status.index != Status.UNTRACKED
        and status.index != Status.IGNORED
        and status.index != Status.DELETED
    )
github greenbone / autohooks / autohooks / api / git.py View on Github external
def is_staged_status(status):
    return (
        status.index != Status.UNMODIFIED
        and status.index != Status.UNTRACKED
        and status.index != Status.IGNORED
        and status.index != Status.DELETED
    )
github greenbone / autohooks / autohooks / api / git.py View on Github external
def is_partially_staged_status(status):
    return (
        status.index != Status.UNMODIFIED
        and status.index != Status.UNTRACKED
        and status.index != Status.IGNORED
        and status.index != Status.DELETED
        and status.working_tree != Status.UNMODIFIED
        and status.working_tree != Status.UNTRACKED
        and status.working_tree != Status.IGNORED
    )
github greenbone / autohooks / autohooks / api / git.py View on Github external
def is_partially_staged_status(status):
    return (
        status.index != Status.UNMODIFIED
        and status.index != Status.UNTRACKED
        and status.index != Status.IGNORED
        and status.index != Status.DELETED
        and status.working_tree != Status.UNMODIFIED
        and status.working_tree != Status.UNTRACKED
        and status.working_tree != Status.IGNORED
    )