def parse_ignore_file(filename, dirname):
    """
    Parse the ignore file and return a list of ignore patterns.
    Each pattern has the complete file path so we can take into account ignore at different levels.
    :param filename: The name of the ignore file.
    :param dirname: The directory Path where the ignore file was found.
    :return: List of ignore patterns.
    """
    ignore_list = []
    with open(filename) as ignore_file:
        for x in ignore_file.readlines():
            x = x.strip()
            if x == '' or x[0] == '#':
                continue
            pattern = str(dirname / x)
            if x[-1] == '/':
                pattern += '/'
            if pattern[-1] == '/':
                ignore_list.append(pattern[:-1])
                pattern += '*'
            ignore_list.append(pattern)
    return ignore_list
