Update diff header index line
The documentation
https://git-scm.com/docs/diff-format#_generating_patches_with_p indicates that "The
index line includes the SHA-1 checksum before and after the change. The <mode>
is included if the file mode does not change; otherwise, separate lines
indicate the old and the new mode."
Update gen_diff_header to match the documentation and CGit behavior.