{"thread":{"id":"9482","subject":"[PATCH] Advertise per branch RSS/Atom feeds","startedAt":"2007-08-11T09:41:41Z","lastAt":"2007-08-11T19:57:31Z","messageCount":2,"participants":["Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"50468","messageId":"7vps1ummqy.fsf@assigned-by-dhcp.cox.net","threadId":"9482","inReplyTo":null,"subject":"[PATCH] Advertise per branch RSS/Atom feeds","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-11T09:41:41Z","receivedAt":"2007-08-11T09:41:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The feeder code had provisions to accept 'h' parameter to\nspecify which branch to send the feed data from, but there was\nno link that advertised this capability on the pages.\n\nThis adds h parameter to the footer of shortlog/log page for the\nbranch.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n gitweb/gitweb.perl |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex f282a67..6c1da14 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2378,12 +2378,16 @@ sub git_footer_html {\n \tprint \"<div class=\\\"page_footer\\\">\\n\";\n \tif (defined $project) {\n \t\tmy $descr = git_get_project_description($project);\n+\t\tmy @tips = ();\n+\t\tif ($hash !~ /^[0-9a-fA-F]{40}$/) {\n+\t\t\t@tips = (hash => $hash);\n+\t\t}\n \t\tif (defined $descr) {\n \t\t\tprint \"<div class=\\\"page_footer_text\\\">\" . esc_html($descr) . \"</div>\\n\";\n \t\t}\n-\t\tprint $cgi->a({-href => href(action=>\"rss\"),\n+\t\tprint $cgi->a({-href => href(action=>\"rss\", @tips),\n \t\t              -class => \"rss_logo\"}, \"RSS\") . \" \";\n-\t\tprint $cgi->a({-href => href(action=>\"atom\"),\n+\t\tprint $cgi->a({-href => href(action=>\"atom\", @tips),\n \t\t              -class => \"rss_logo\"}, \"Atom\") . \"\\n\";\n \t} else {\n \t\tprint $cgi->a({-href => href(project=>undef, action=>\"opml\"),\n"},{"id":"50511","messageId":"200708112157.31764.jnareb@gmail.com","threadId":"9482","inReplyTo":"7vps1ummqy.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Advertise per branch RSS/Atom feeds","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-08-11T19:57:31Z","receivedAt":"2007-08-11T19:57:31Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 11 August 2007, Junio C Hamano wrote:\n\n> The feeder code had provisions to accept 'h' parameter to\n> specify which branch to send the feed data from, but there was\n> no link that advertised this capability on the pages.\n> \n> This adds h parameter to the footer of shortlog/log page for the\n> branch.\n\nAnd also of 'history' and 'tree' views; see comments below.\n\nBesides, that is only half of the places where we put links to\nRSS/Atom feeds. There are RSS/Atom feeds in the page header,\nin the form of \"<link .../>\" elements; but that is perhaps for\nseparate patch. I think for example that we should add more\nspecialized feeds to HTML header instead of replacing generic\nfeeds by specialized ones like this patch does in footer.\n\n>  \tif (defined $project) {\n>  \t\tmy $descr = git_get_project_description($project);\n> +\t\tmy @tips = ();\n> +\t\tif ($hash !~ /^[0-9a-fA-F]{40}$/) {\n> +\t\t\t@tips = (hash => $hash);\n> +\t\t}\n\nI'd use hash instead of array (list) here, c.f. %hash_base trick,\ni.e. \"my %tips\" and \"%tips = (hash => $hash);\". Just for code\nconsistency and slightly better readibility.\n\nBy the way, the above would work also for 'history' and 'tree'\nviews if h parameter is not literal hash (perhaps we should exclude\n\"HEAD\" as well, by the way), and we can have path limited feeds,\nthen perhaps it would be even better to use\n\n\t\t\t%tips = (hash=>$hash, file_name=>$file_name);\n\nI'm also not sure if %tips (or @tips) is best name for this variable,\nbut I don't have better proposal. %narrow perhaps or something like\nthat.\n\n>  \t\tif (defined $descr) {\n>  \t\t\tprint \"<div class=\\\"page_footer_text\\\">\" . esc_html($descr) . \"</div>\\n\";\n>  \t\t}\n> -\t\tprint $cgi->a({-href => href(action=>\"rss\"),\n> +\t\tprint $cgi->a({-href => href(action=>\"rss\", @tips),\n>  \t\t              -class => \"rss_logo\"}, \"RSS\") . \" \";\n> -\t\tprint $cgi->a({-href => href(action=>\"atom\"),\n> +\t\tprint $cgi->a({-href => href(action=>\"atom\", @tips),\n>  \t\t              -class => \"rss_logo\"}, \"Atom\") . \"\\n\";\n>  \t} else {\n>  \t\tprint $cgi->a({-href => href(project=>undef, action=>\"opml\"),\n> \n\nAnd perhaps we should add title attribute explaining that feed is for\ngiven branch... or perhaps not.\n\n-- \nJakub Narebski\nPoland\n"}]}