Returns parent repo or input path if none found.

    :return: grit.Local or path

def get_repo_parent(path):
    """
    Returns parent repo or input path if none found.

    :return: grit.Local or path
    """
    # path is a repository
    if is_repo(path):
        return Local(path)

    # path is inside a repository
    elif not os.path.isdir(path):
        _rel = ''
        while path and path != '/':
            if is_repo(path):
                return Local(path)
            else:
                _rel = os.path.join(os.path.basename(path), _rel)
                path = os.path.dirname(path)
        return path