gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line
authorJakub Narebski <jnareb@gmail.com>
Thu, 1 Nov 2007 11:38:08 +0000 (12:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2007 00:34:41 +0000 (17:34 -0700)
commit9d3014566302ad0d3d378b0a1653959b3118066d
tree3d8e8d0667d17b39b8bbd8d29a551ec03fd84b68
parent3e4bb087a18435b12eb82116e93af2887578e816
gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line

Always set 'from_file' and 'to_file' keys when parsing raw diff output
format line, even if filename didn't change (file was not renamed).
This allows for simpler code.

Previously, you would have written:

  $diffinfo->{'from_file'} || $diffinfo->{'file'}

but now you can just use

  $diffinfo->{'from_file'}

as 'from_file' is always defined.

While at it, replace (for merge commits)

  $diffinfo->{'from_file'}[$i] || $diffinfo->{'to_file'}

by

  defined $diffinfo->{'from_file'}[$i] ?
          $diffinfo->{'from_file'}[$i] :
          $diffinfo->{'to_file'};

to have no problems with file named '0'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl