{"thread":{"id":"5448","subject":"[PATCH] gitweb: Fix git_blame","startedAt":"2006-09-01T03:43:32Z","lastAt":"2006-09-01T20:12:29Z","messageCount":6,"participants":["Aneesh Kumar K.V","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"26178","messageId":"ed8a90$pfn$1@sea.gmane.org","threadId":"5448","inReplyTo":null,"subject":"[PATCH] gitweb: Fix git_blame","fromName":"Aneesh Kumar K.V","fromEmail":"aneesh.kumar@gmail.com","sentAt":"2006-09-01T03:43:32Z","receivedAt":"2006-09-01T03:43:32Z","isPatch":true,"sender":{"key":"aneesh.kumar@gmail.com","avatar":"https://gravatar.com/avatar/0621fc0b2f14ead1e9024382f16053a808c148596da30c1b92572fa075621f68?d=mp&s=160"},"body":"\n\n\nConverting the default values to array broke the git blame enable\ndisable support. Fix the same.\n\nSigned-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n---\n gitweb/gitweb.perl |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0984e85..57ffa25 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2251,7 +2251,8 @@ sub git_blame2 {\n \tmy $fd;\n \tmy $ftype;\n \n-\tif (!gitweb_check_feature('blame')) {\n+\tmy ($have_blame) = gitweb_check_feature('blame');\n+\tif (!$have_blame) {\n \t\tdie_error('403 Permission denied', \"Permission denied\");\n \t}\n \tdie_error('404 Not Found', \"File name not defined\") if (!$file_name);\n@@ -2320,7 +2321,8 @@ HTML\n sub git_blame {\n \tmy $fd;\n \n-\tif (!gitweb_check_feature('blame')) {\n+\tmy ($have_blame) = gitweb_check_feature('blame');\n+\tif (!$have_blame) {\n \t\tdie_error('403 Permission denied', \"Permission denied\");\n \t}\n \tdie_error('404 Not Found', \"File name not defined\") if (!$file_name);\n@@ -2494,7 +2496,7 @@ sub git_blob {\n \t\t\tdie_error(undef, \"No file name defined\");\n \t\t}\n \t}\n-\tmy $have_blame = gitweb_check_feature('blame');\n+\tmy ($have_blame) = gitweb_check_feature('blame');\n \topen my $fd, \"-|\", git_cmd(), \"cat-file\", \"blob\", $hash\n \t\tor die_error(undef, \"Couldn't cat $file_name, $hash\");\n \tmy $mimetype = blob_mimetype($fd, $file_name);\n@@ -2570,7 +2572,7 @@ sub git_tree {\n \tmy $ref = format_ref_marker($refs, $hash_base);\n \tgit_header_html();\n \tmy $base = \"\";\n-\tmy $have_blame = gitweb_check_feature('blame');\n+\tmy ($have_blame) = gitweb_check_feature('blame');\n \tif (defined $hash_base && (my %co = parse_commit($hash_base))) {\n \t\tgit_print_page_nav('tree','', $hash_base);\n \t\tgit_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);\n-- \n1.4.2.rc1.g83e1-dirty\n\n"},{"id":"26182","messageId":"ed8t86$cd8$1@sea.gmane.org","threadId":"5448","inReplyTo":"ed8a90$pfn$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: Fix git_blame","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-01T09:07:23Z","receivedAt":"2006-09-01T09:07:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Aneesh Kumar wrote:\n\n> Converting the default values to array broke the git blame enable\n> disable support. Fix the same.\n> \n> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n\nHmmm.... git^W got applied (1d3fc68a), but commit message was lost.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"26190","messageId":"11571390683018-git-send-email-jnareb@gmail.com","threadId":"5448","inReplyTo":"ed8a90$pfn$1@sea.gmane.org","subject":"[PATCH] gitweb: gitweb_check_feature always return list","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-01T19:31:08Z","receivedAt":"2006-09-01T19:31:08Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Modified feature_blame so it returns one-element list and not scalar,\nthus making gitweb_check_feature always return list.  Updated comment\nto explain that part.\n\nThis is continuation of Aneesh Kumar work:\n  gitweb: Fix git_blame\n\"Converting the default values to array broke the git blame enable\n disable support. Fix the same.\"\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nWe could modify %feature hash so the 'default' value could be either\narray reference or a scalar instead.\n\n gitweb/gitweb.perl |   13 ++++++++-----\n 1 files changed, 8 insertions(+), 5 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 57ffa25..06bdb0e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -74,9 +74,12 @@ our %feature = (\n \t#\n \t# if feature is overridable (it means that allow-override has true value,\n \t# then feature-sub will be called with default options as parameters;\n-\t# return value of feature-sub indicates if to enable specified feature\n+\t# return value of feature-sub indicates if to enable specified feature,\n+\t# and is taken to be current parameters of the feature\n \t#\n-\t# use gitweb_check_feature(<feature>) to check if <feature> is enabled\n+\t# use gitweb_check_feature(<feature>) to check if <feature> is enabled;\n+\t# to be more exact to get current parameters of <feature>;\n+\t# gitweb_check_feature(<feature>) returns array (list) of current options\n \n \t'blame' => {\n \t\t'sub' => \\&feature_blame,\n@@ -111,12 +114,12 @@ sub feature_blame {\n \tmy ($val) = git_get_project_config('blame', '--bool');\n \n \tif ($val eq 'true') {\n-\t\treturn 1;\n+\t\treturn (1);\n \t} elsif ($val eq 'false') {\n-\t\treturn 0;\n+\t\treturn (0);\n \t}\n \n-\treturn $_[0];\n+\treturn ($_[0]);\n }\n \n # To disable system wide have in $GITWEB_CONFIG\n-- \n1.4.1.1\n"},{"id":"26191","messageId":"7vk64n5qep.fsf@assigned-by-dhcp.cox.net","threadId":"5448","inReplyTo":"11571390683018-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] gitweb: gitweb_check_feature always return list","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-01T19:37:50Z","receivedAt":"2006-09-01T19:37:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Modified feature_blame so it returns one-element list and not scalar,\n> thus making gitweb_check_feature always return list.  Updated comment\n> to explain that part.\n\nI do not understand what you are fixing.\n\n\tsub A { return (1); }\n        sub B { return 1; }\n\nDon't they quack the same way?\n"},{"id":"26192","messageId":"eda2q0$la8$1@sea.gmane.org","threadId":"5448","inReplyTo":"7vk64n5qep.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: gitweb_check_feature always return list","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-01T19:48:23Z","receivedAt":"2006-09-01T19:48:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> Modified feature_blame so it returns one-element list and not scalar,\n>> thus making gitweb_check_feature always return list.  Updated comment\n>> to explain that part.\n> \n> I do not understand what you are fixing.\n> \n>       sub A { return (1); }\n>       sub B { return 1; }\n> \n> Don't they quack the same way?\n\nWell, that is just nitpicking. gitweb_check_feature returns list if feature\nis not overridable, so I made it that it always returns list.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"26194","messageId":"eda475$ob7$1@sea.gmane.org","threadId":"5448","inReplyTo":"eda2q0$la8$1@sea.gmane.org","subject":"Re: [PATCH] gitweb: gitweb_check_feature always return list","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-09-01T20:12:29Z","receivedAt":"2006-09-01T20:12:29Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"<opublikowany i wysłany>\n\nJakub Narebski wrote:\n\n> Junio C Hamano wrote:\n> \n>> Jakub Narebski <jnareb@gmail.com> writes:\n>> \n>>> Modified feature_blame so it returns one-element list and not scalar,\n>>> thus making gitweb_check_feature always return list.  Updated comment\n>>> to explain that part.\n>> \n>> I do not understand what you are fixing.\n>> \n>>       sub A { return (1); }\n>>       sub B { return 1; }\n>> \n>> Don't they quack the same way?\n> \n> Well, that is just nitpicking. gitweb_check_feature returns list if feature\n> is not overridable, so I made it that it always returns list.\n\nThen I'm not sure if Aneesh Kumar patch I replied to is really necessary.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n\n\n-- \nVGER BF report: U 0.499824\n"}]}