def create_gitbom_doc_text(infile_hashes, db):
    """
    Create the gitBOM doc text contents
    :param infile_hashes: the list of input files, with its hashes, essentially a dict
    :param db: gitBOM DB with {file-hash => its gitBOM hash} mapping
    """
    if not infile_hashes:
        return ''
    lines = []
    for afile in infile_hashes:
        ahash = infile_hashes[afile]
        line = "blob " + ahash
        if ahash in db:
            gitbom_hash = db[ahash]
            line += " bom " + gitbom_hash
        lines.append(line)
    lines.sort()
    return '\n'.join(lines) + '\n'