def _remove_trailing_extra_blank_lines_from_subject(lines):
    """Different versions of git will output different amounts of trailing
    whitespace at the end of a subject headers, so we normalize it by only
    allowing a single trailing blank line.
    """
    for idx, line in enumerate(lines):
        if line.startswith('diff --git'):
            break
    else:
        return
    if idx < 2:
        return
    if not lines[idx - 1].strip() and not lines[idx - 2].strip():
        del lines[idx - 1]
