* [PATCH] gitweb: Fix git_blame
@ 2006-09-01 3:43 Aneesh Kumar K.V
2006-09-01 9:07 ` Jakub Narebski
2006-09-01 19:31 ` [PATCH] gitweb: gitweb_check_feature always return list Jakub Narebski
0 siblings, 2 replies; 6+ messages in thread
From: Aneesh Kumar K.V @ 2006-09-01 3:43 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 0001-gitweb-Fix-git_blame.txt --]
[-- Type: text/plain, Size: 1806 bytes --]
Converting the default values to array broke the git blame enable
disable support. Fix the same.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
---
gitweb/gitweb.perl | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 0984e85..57ffa25 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2251,7 +2251,8 @@ sub git_blame2 {
my $fd;
my $ftype;
- if (!gitweb_check_feature('blame')) {
+ my ($have_blame) = gitweb_check_feature('blame');
+ if (!$have_blame) {
die_error('403 Permission denied', "Permission denied");
}
die_error('404 Not Found', "File name not defined") if (!$file_name);
@@ -2320,7 +2321,8 @@ HTML
sub git_blame {
my $fd;
- if (!gitweb_check_feature('blame')) {
+ my ($have_blame) = gitweb_check_feature('blame');
+ if (!$have_blame) {
die_error('403 Permission denied', "Permission denied");
}
die_error('404 Not Found', "File name not defined") if (!$file_name);
@@ -2494,7 +2496,7 @@ sub git_blob {
die_error(undef, "No file name defined");
}
}
- my $have_blame = gitweb_check_feature('blame');
+ my ($have_blame) = gitweb_check_feature('blame');
open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash
or die_error(undef, "Couldn't cat $file_name, $hash");
my $mimetype = blob_mimetype($fd, $file_name);
@@ -2570,7 +2572,7 @@ sub git_tree {
my $ref = format_ref_marker($refs, $hash_base);
git_header_html();
my $base = "";
- my $have_blame = gitweb_check_feature('blame');
+ my ($have_blame) = gitweb_check_feature('blame');
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
git_print_page_nav('tree','', $hash_base);
git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);
--
1.4.2.rc1.g83e1-dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: Fix git_blame
2006-09-01 3:43 [PATCH] gitweb: Fix git_blame Aneesh Kumar K.V
@ 2006-09-01 9:07 ` Jakub Narebski
2006-09-01 19:31 ` [PATCH] gitweb: gitweb_check_feature always return list Jakub Narebski
1 sibling, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2006-09-01 9:07 UTC (permalink / raw)
To: git
Aneesh Kumar wrote:
> Converting the default values to array broke the git blame enable
> disable support. Fix the same.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>
Hmmm.... git^W got applied (1d3fc68a), but commit message was lost.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] gitweb: gitweb_check_feature always return list
2006-09-01 3:43 [PATCH] gitweb: Fix git_blame Aneesh Kumar K.V
2006-09-01 9:07 ` Jakub Narebski
@ 2006-09-01 19:31 ` Jakub Narebski
2006-09-01 19:37 ` Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-09-01 19:31 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
Modified feature_blame so it returns one-element list and not scalar,
thus making gitweb_check_feature always return list. Updated comment
to explain that part.
This is continuation of Aneesh Kumar work:
gitweb: Fix git_blame
"Converting the default values to array broke the git blame enable
disable support. Fix the same."
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
We could modify %feature hash so the 'default' value could be either
array reference or a scalar instead.
gitweb/gitweb.perl | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 57ffa25..06bdb0e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -74,9 +74,12 @@ our %feature = (
#
# if feature is overridable (it means that allow-override has true value,
# then feature-sub will be called with default options as parameters;
- # return value of feature-sub indicates if to enable specified feature
+ # return value of feature-sub indicates if to enable specified feature,
+ # and is taken to be current parameters of the feature
#
- # use gitweb_check_feature(<feature>) to check if <feature> is enabled
+ # use gitweb_check_feature(<feature>) to check if <feature> is enabled;
+ # to be more exact to get current parameters of <feature>;
+ # gitweb_check_feature(<feature>) returns array (list) of current options
'blame' => {
'sub' => \&feature_blame,
@@ -111,12 +114,12 @@ sub feature_blame {
my ($val) = git_get_project_config('blame', '--bool');
if ($val eq 'true') {
- return 1;
+ return (1);
} elsif ($val eq 'false') {
- return 0;
+ return (0);
}
- return $_[0];
+ return ($_[0]);
}
# To disable system wide have in $GITWEB_CONFIG
--
1.4.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: gitweb_check_feature always return list
2006-09-01 19:31 ` [PATCH] gitweb: gitweb_check_feature always return list Jakub Narebski
@ 2006-09-01 19:37 ` Junio C Hamano
2006-09-01 19:48 ` Jakub Narebski
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-09-01 19:37 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
Jakub Narebski <jnareb@gmail.com> writes:
> Modified feature_blame so it returns one-element list and not scalar,
> thus making gitweb_check_feature always return list. Updated comment
> to explain that part.
I do not understand what you are fixing.
sub A { return (1); }
sub B { return 1; }
Don't they quack the same way?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: gitweb_check_feature always return list
2006-09-01 19:37 ` Junio C Hamano
@ 2006-09-01 19:48 ` Jakub Narebski
2006-09-01 20:12 ` Jakub Narebski
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Narebski @ 2006-09-01 19:48 UTC (permalink / raw)
To: git
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>> Modified feature_blame so it returns one-element list and not scalar,
>> thus making gitweb_check_feature always return list. Updated comment
>> to explain that part.
>
> I do not understand what you are fixing.
>
> sub A { return (1); }
> sub B { return 1; }
>
> Don't they quack the same way?
Well, that is just nitpicking. gitweb_check_feature returns list if feature
is not overridable, so I made it that it always returns list.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gitweb: gitweb_check_feature always return list
2006-09-01 19:48 ` Jakub Narebski
@ 2006-09-01 20:12 ` Jakub Narebski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Narebski @ 2006-09-01 20:12 UTC (permalink / raw)
To: git
<opublikowany i wysłany>
Jakub Narebski wrote:
> Junio C Hamano wrote:
>
>> Jakub Narebski <jnareb@gmail.com> writes:
>>
>>> Modified feature_blame so it returns one-element list and not scalar,
>>> thus making gitweb_check_feature always return list. Updated comment
>>> to explain that part.
>>
>> I do not understand what you are fixing.
>>
>> sub A { return (1); }
>> sub B { return 1; }
>>
>> Don't they quack the same way?
>
> Well, that is just nitpicking. gitweb_check_feature returns list if feature
> is not overridable, so I made it that it always returns list.
Then I'm not sure if Aneesh Kumar patch I replied to is really necessary.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
--
VGER BF report: U 0.499824
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-09-01 20:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-01 3:43 [PATCH] gitweb: Fix git_blame Aneesh Kumar K.V
2006-09-01 9:07 ` Jakub Narebski
2006-09-01 19:31 ` [PATCH] gitweb: gitweb_check_feature always return list Jakub Narebski
2006-09-01 19:37 ` Junio C Hamano
2006-09-01 19:48 ` Jakub Narebski
2006-09-01 20:12 ` Jakub Narebski
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).