Q:

git-log: Split Typechange into Add and Delete

I output a raw diff of a commit using
git log -1 --raw <sha1>

Now that output can contain TYPECHANGE records like this
:100644 120000 <old-sha> <new-sha> T My/Changed/File

If the raw diff is output in conjuction with a patch like so
git log -1 -p --raw <sha1>

the file My/Changed/File will show up as 2 patches, one for a DELETION and another ADDITION. I'd like to get the correct filenames from the raw part, and use the diff from the patch output, but since the number of diffs is not equal to the raw diff entries, I cant match them up one-by-one.
Is it possible to tell git to split TYPECHANGE entries in the raw diff into a DELETION/ADDITION pair, so it looks like this?
:100644 000000 <old-sha> 000000000 D My/Changed/File
:000000 120000 000000000 <new-sha> A My/Changed/File

A:

A type-change entry means that what was a file is now a symbolic link, or vice versa.1
There are no lines to add or delete.  Git must completely remove the old file-or-symlink—whichever it was—and completely install the new symlink-or-file.  The reason git log -p or git show shows this as "delete one name, add new entity with same name" is that it really, actually requires two steps ... but those two steps represent a single change when comparing old (a/) commit vs new (b/) commit.
If you are just trying to match the fields up, just remember that all T-status changes are achieved by two separate operations: delete the old, add the new.

1It could also represent a change from file to gitlink, or vice versa, or from symlink to gitlink, or vice versa.  I think this covers all the possibilities, as a non-tree becoming a tree, or vice versa, is always represented by add/delete of the files that cause the tree to exist.  If Git could store empty tree objects, Git might want a T mode for empty-directory-to-file or vice versa, though.

