Re: [PATCH/RFC 1/4] contrib: add git-contacts helper
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 1, 2013, 19:17 UTC
- Message-ID
- <7vy59qf5to.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <7vbo6mgm5e.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> - 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;