]> Lady’s Gitweb - Gitweb/commit
gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line
authorJakub Narebski <redacted>
Thu, 1 Nov 2007 11:38:08 +0000 (12:38 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:12 +0000 (00:07 -0400)
commit55813736c8da68573812e63e1e2e9615b2386a3a58a302f4da23f3c0d11816d0
treeeb5ac76feea24920fd32a35357da5b107fb69284882435f281b20a61a2261972
parent12553497175c810e696cffe42283f148e1eba08b90582513fb806fa6c5999735
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.222411 seconds and 4 git commands to generate.