Re: [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:11
Jakub Narebski [off-list ref] writes:
Junio C Hamano wrote:quoted
Jakub Narebski [off-list ref] writes:quoted
Initial (root) commit has no parents, and $co{'parent'} is undefined. Use '--root' for initial commit. This fixes "Use of uninitialized value in open at gitweb/gitweb.perl line 4925." warning.[...]quoted
quoted
--- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl@@ -4923,7 +4923,8 @@ XML # get list of changed files open my $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts, - $co{'parent'}, $co{'id'}, "--", (defined $file_name ? $file_name : ()) + $co{'parent'} || "--root", + $co{'id'}, "--", (defined $file_name ? $file_name : ()) or next; my @difftree = map { chomp; $_ } <$fd>; close $fdI do not think you would need to make --root conditional...I need at last make $co{'parent'} conditional, i.e. at least "$co{'parent'} || ()" or equivalent (e.g. like for $file_name). I cannot omit $co{'parent'} because parents might be rewritten; feeds accept now path limiting. So why not this way?
Ah, clever (buuuuuuut misleading) ;-)