gitweb: Fix "Use of uninitialized value" warning in git_feed
authorJakub Narebski <jnareb@gmail.com>
Sat, 19 May 2007 00:47:51 +0000 (02:47 +0200)
committerJunio C Hamano <junkio@cox.net>
Sat, 19 May 2007 02:49:45 +0000 (19:49 -0700)
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.

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

index 17d8efb29cfa99f4d3b8e3dfaa9aec45fcdd43bb..5c7011a37b2e4dab8c38de54a3e531d2fa16ddbe 100755 (executable)
@@ -5040,7 +5040,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 $fd