Junio C Hamano [off-list ref] writes:
- If the patch were prepared with a non-standard src/dst-prefix,
unconditional substr($1, 2) would call blame on a wrong (and
likely to be nonexistent) path without a useful diagnosis (the
invocation of "git blame" will likely die with "no such path
'tailofpathname' in $id").
One way to make it more robust may be to do something like this:
if (/^--- /) {
if (m{^--- (?:a/(.*)|/dev/null)$}) {
$source = ($1 eq '/dev/null') ? undef : $1;
Typo/thinko. I did that (?:(foo)|bar) thing so that I do not have
to do the conditional. The above can just be
if (m{^--- (?:a/(.*)|/dev/null)$}) {
$source = $1;