git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed

From
Junio C Hamano <junkio@cox.net>
Date
May 19, 2007, 01:45 UTC
Message-ID
<7vtzu937t6.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<1179535671566-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 25 quoted lines
> 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>
> ---
>  gitweb/gitweb.perl |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index fa8cc02..091cf9c 100755
> --- 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 $fd
I do not think you would need to make --root conditional...
Previous: Jakub NarebskiNext: Jakub Narebski
Message 2 of 4 in “gitweb: Fix "Use of uninitialized value" warning in git_feed”
  1. gitweb: Fix "Use of uninitialized value" warning in git_feedJakub Narebski, May 19, 2007
  2. Junio C HamanoMay 19, 2007
  3. Jakub NarebskiMay 19, 2007
  4. Junio C HamanoMay 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.