Code

gitweb: Fix error in git_patchset_body for deletion in merge commit
authorJakub Narebski <jnareb@gmail.com>
Thu, 17 May 2007 20:54:28 +0000 (22:54 +0200)
committerJunio C Hamano <junkio@cox.net>
Fri, 18 May 2007 00:35:33 +0000 (17:35 -0700)
Checking if $diffinfo->{'status'} is equal 'D' is no longer the way to
check if the file was deleted in result.  For merge commits
$diffinfo->{'status'} is reference to array of statuses for each
parent.  Use the fact that $diffinfo->{'to_id'} is all zeros as sign
that file was deleted in result.

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

index 6f5df9174ec80d4decf4be8111f84e79411a156d..66f306705f083da30a4629dc16f3aad604d4db51 100755 (executable)
@@ -2722,8 +2722,9 @@ sub git_patchset_body {
                                        delete $from{'href'};
                                }
                        }
+
                        $to{'file'} = $diffinfo->{'to_file'} || $diffinfo->{'file'};
-                       if ($diffinfo->{'status'} ne "D") { # not deleted file
+                       if ($diffinfo->{'to_id'} ne ('0' x 40)) { # file exists in result
                                $to{'href'} = href(action=>"blob", hash_base=>$hash,
                                                   hash=>$diffinfo->{'to_id'},
                                                   file_name=>$to{'file'});