git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project
       [not found] <4BAE4F07.3040806@gentoo.org>
@ 2010-03-27 19:27 ` Jakub Narebski
  2010-03-31 17:47   ` Jakub Narebski
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2010-03-27 19:27 UTC (permalink / raw)
  To: Tobias Heinlein; +Cc: Junio C Hamano, Eli Barzilay, git

On Sat, 27 Mar 2010, Tobias Heinlein wrote:

> I stumbled upon a small bug in gitweb that was introduced by commit
> 9be3614eff36271d5f1cd460a568a219902cb044.
> 
> The projects list page is no longer able to display the projects'
> descriptions and owners properly when they are set in the git config
> file, e.g. like this:
> 
>   [gitweb]
>           owner = Tobias Heinlein
>           description = test
> 
> This is because git_get_project_owner() calls
> git_get_project_config('owner'):
> 
>   sub git_get_project_config {
>           my ($key, $type) = @_;
> 
>           # do we have project
>           return unless (defined $project && defined $git_dir);
> 
> At this point, $project is not defined (because it doesn't have to;
> $git_dir is defined, though, due to another change in the said
> commit), causing the call to return early at the newly introduced
> line of code. 
> 
> Determining the description fails accordingly.
> 
> I'm afraid I can't provide a patch as my Perl foo isn't that good.

Does the following patch fixes this issue?

-- >8 --
From: Jakub Narebski <jnareb@gmail.com>
Date: Sat, 27 Mar 2010 20:26:59 +0100
Subject: [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project

Fix overeager early return in git_get_project_config, introduced in 9be3614
(gitweb: Fix project-specific feature override behavior, 2010-03-01).  When
git_get_project_config is called from projects list page via
git_get_project_owner($path) etc., it is called with $git_dir defined (in
git_get_project_owner($path) etc.), but $project variable is not defined.
git_get_project_config doesn't use $project variable anyway.

Reported-by: Tobias Heinlein <keytoaster@gentoo.org>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a2d2283..c356e95 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2216,8 +2216,7 @@ sub config_to_multi {
 sub git_get_project_config {
 	my ($key, $type) = @_;
 
-	# do we have project
-	return unless (defined $project && defined $git_dir);
+	return unless defined $git_dir;
 
 	# key sanity check
 	return unless ($key);
-- 
1.7.0.1

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

* Re: [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project
  2010-03-27 19:27 ` [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project Jakub Narebski
@ 2010-03-31 17:47   ` Jakub Narebski
  2010-03-31 17:56     ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Narebski @ 2010-03-31 17:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Tobias Heinlein, git

Ping!  This patch is straight fix for a recently introduced bug
(in a bugfix)... and it removes more than it adds.

On Sat, 27 Mar 2010, Jakub Narebski wrote:
> On Sat, 27 Mar 2010, Tobias Heinlein wrote:
> 
> > I stumbled upon a small bug in gitweb that was introduced by commit
> > 9be3614eff36271d5f1cd460a568a219902cb044.
> > 
> > The projects list page is no longer able to display the projects'
> > descriptions and owners properly when they are set in the git config
> > file, e.g. like this:
> > 
> >   [gitweb]
> >           owner = Tobias Heinlein
> >           description = test
[...]

> Does the following patch fixes this issue?
> 
> -- >8 --
> From: Jakub Narebski <jnareb@gmail.com>
> Date: Sat, 27 Mar 2010 20:26:59 +0100
> Subject: [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project
> 
> Fix overeager early return in git_get_project_config, introduced in 9be3614
> (gitweb: Fix project-specific feature override behavior, 2010-03-01).  When
> git_get_project_config is called from projects list page via
> git_get_project_owner($path) etc., it is called with $git_dir defined (in
> git_get_project_owner($path) etc.), but $project variable is not defined.
> git_get_project_config doesn't use $project variable anyway.
> 
> Reported-by: Tobias Heinlein <keytoaster@gentoo.org>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
>  gitweb/gitweb.perl |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index a2d2283..c356e95 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2216,8 +2216,7 @@ sub config_to_multi {
>  sub git_get_project_config {
>  	my ($key, $type) = @_;
>  
> -	# do we have project
> -	return unless (defined $project && defined $git_dir);
> +	return unless defined $git_dir;
>  
>  	# key sanity check
>  	return unless ($key);
> -- 
> 1.7.0.1
> 
> 

-- 
Jakub Narebski
Poland

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

* Re: [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project
  2010-03-31 17:47   ` Jakub Narebski
@ 2010-03-31 17:56     ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-03-31 17:56 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Tobias Heinlein, git

Jakub Narebski <jnareb@gmail.com> writes:

> Ping!  This patch is straight fix for a recently introduced bug
> (in a bugfix)... and it removes more than it adds.

I took your "Does this fix?" as a request for Tested-By: and has been
waiting for the exchange between you two to move forward.

I'll queue it; thanks for the reminder.

>
> On Sat, 27 Mar 2010, Jakub Narebski wrote:
>> On Sat, 27 Mar 2010, Tobias Heinlein wrote:
>> 
>> > I stumbled upon a small bug in gitweb that was introduced by commit
>> > 9be3614eff36271d5f1cd460a568a219902cb044.
>> > 
>> > The projects list page is no longer able to display the projects'
>> > descriptions and owners properly when they are set in the git config
>> > file, e.g. like this:
>> > 
>> >   [gitweb]
>> >           owner = Tobias Heinlein
>> >           description = test
> [...]
>
>> Does the following patch fixes this issue?
>> 
>> -- >8 --
>> From: Jakub Narebski <jnareb@gmail.com>
>> Date: Sat, 27 Mar 2010 20:26:59 +0100
>> Subject: [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project
>> 
>> Fix overeager early return in git_get_project_config, introduced in 9be3614
>> (gitweb: Fix project-specific feature override behavior, 2010-03-01).  When
>> git_get_project_config is called from projects list page via
>> git_get_project_owner($path) etc., it is called with $git_dir defined (in
>> git_get_project_owner($path) etc.), but $project variable is not defined.
>> git_get_project_config doesn't use $project variable anyway.
>> 
>> Reported-by: Tobias Heinlein <keytoaster@gentoo.org>
>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
>> ---
>>  gitweb/gitweb.perl |    3 +--
>>  1 files changed, 1 insertions(+), 2 deletions(-)
>> 
>> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
>> index a2d2283..c356e95 100755
>> --- a/gitweb/gitweb.perl
>> +++ b/gitweb/gitweb.perl
>> @@ -2216,8 +2216,7 @@ sub config_to_multi {
>>  sub git_get_project_config {
>>  	my ($key, $type) = @_;
>>  
>> -	# do we have project
>> -	return unless (defined $project && defined $git_dir);
>> +	return unless defined $git_dir;
>>  
>>  	# key sanity check
>>  	return unless ($key);
>> -- 
>> 1.7.0.1
>> 
>> 
>
> -- 
> Jakub Narebski
> Poland

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

end of thread, other threads:[~2010-03-31 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4BAE4F07.3040806@gentoo.org>
2010-03-27 19:27 ` [PATCH] gitweb: git_get_project_config requires only $git_dir, not also $project Jakub Narebski
2010-03-31 17:47   ` Jakub Narebski
2010-03-31 17:56     ` 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).