git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed
@ 2007-05-19  0:47 Jakub Narebski
  2007-05-19  1:45 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2007-05-19  0:47 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski

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
-- 
1.5.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed
  2007-05-19  0:47 [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed Jakub Narebski
@ 2007-05-19  1:45 ` Junio C Hamano
  2007-05-19  2:08   ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2007-05-19  1:45 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> 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...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed
  2007-05-19  1:45 ` Junio C Hamano
@ 2007-05-19  2:08   ` Jakub Narebski
  2007-05-19  2:49     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Narebski @ 2007-05-19  2:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> 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.
[...]
>> --- 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...

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?
-- 
Jakub Narebski
Poland

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed
  2007-05-19  2:08   ` Jakub Narebski
@ 2007-05-19  2:49     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-05-19  2:49 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

Jakub Narebski <jnareb@gmail.com> writes:

> Junio C Hamano wrote:
>> Jakub Narebski <jnareb@gmail.com> writes:
>> 
>>> 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.
> [...]
>>> --- 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...
>
> 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) ;-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-19  2:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-19  0:47 [PATCH] gitweb: Fix "Use of uninitialized value" warning in git_feed Jakub Narebski
2007-05-19  1:45 ` Junio C Hamano
2007-05-19  2:08   ` Jakub Narebski
2007-05-19  2:49     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).