* [PATCH] Advertise per branch RSS/Atom feeds
@ 2007-08-11 9:41 Junio C Hamano
2007-08-11 19:57 ` Jakub Narebski
0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2007-08-11 9:41 UTC (permalink / raw)
To: git; +Cc: Jakub Narebski
The feeder code had provisions to accept 'h' parameter to
specify which branch to send the feed data from, but there was
no link that advertised this capability on the pages.
This adds h parameter to the footer of shortlog/log page for the
branch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
gitweb/gitweb.perl | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f282a67..6c1da14 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2378,12 +2378,16 @@ sub git_footer_html {
print "<div class=\"page_footer\">\n";
if (defined $project) {
my $descr = git_get_project_description($project);
+ my @tips = ();
+ if ($hash !~ /^[0-9a-fA-F]{40}$/) {
+ @tips = (hash => $hash);
+ }
if (defined $descr) {
print "<div class=\"page_footer_text\">" . esc_html($descr) . "</div>\n";
}
- print $cgi->a({-href => href(action=>"rss"),
+ print $cgi->a({-href => href(action=>"rss", @tips),
-class => "rss_logo"}, "RSS") . " ";
- print $cgi->a({-href => href(action=>"atom"),
+ print $cgi->a({-href => href(action=>"atom", @tips),
-class => "rss_logo"}, "Atom") . "\n";
} else {
print $cgi->a({-href => href(project=>undef, action=>"opml"),
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Advertise per branch RSS/Atom feeds
2007-08-11 9:41 [PATCH] Advertise per branch RSS/Atom feeds Junio C Hamano
@ 2007-08-11 19:57 ` Jakub Narebski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Narebski @ 2007-08-11 19:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Sat, 11 August 2007, Junio C Hamano wrote:
> The feeder code had provisions to accept 'h' parameter to
> specify which branch to send the feed data from, but there was
> no link that advertised this capability on the pages.
>
> This adds h parameter to the footer of shortlog/log page for the
> branch.
And also of 'history' and 'tree' views; see comments below.
Besides, that is only half of the places where we put links to
RSS/Atom feeds. There are RSS/Atom feeds in the page header,
in the form of "<link .../>" elements; but that is perhaps for
separate patch. I think for example that we should add more
specialized feeds to HTML header instead of replacing generic
feeds by specialized ones like this patch does in footer.
> if (defined $project) {
> my $descr = git_get_project_description($project);
> + my @tips = ();
> + if ($hash !~ /^[0-9a-fA-F]{40}$/) {
> + @tips = (hash => $hash);
> + }
I'd use hash instead of array (list) here, c.f. %hash_base trick,
i.e. "my %tips" and "%tips = (hash => $hash);". Just for code
consistency and slightly better readibility.
By the way, the above would work also for 'history' and 'tree'
views if h parameter is not literal hash (perhaps we should exclude
"HEAD" as well, by the way), and we can have path limited feeds,
then perhaps it would be even better to use
%tips = (hash=>$hash, file_name=>$file_name);
I'm also not sure if %tips (or @tips) is best name for this variable,
but I don't have better proposal. %narrow perhaps or something like
that.
> if (defined $descr) {
> print "<div class=\"page_footer_text\">" . esc_html($descr) . "</div>\n";
> }
> - print $cgi->a({-href => href(action=>"rss"),
> + print $cgi->a({-href => href(action=>"rss", @tips),
> -class => "rss_logo"}, "RSS") . " ";
> - print $cgi->a({-href => href(action=>"atom"),
> + print $cgi->a({-href => href(action=>"atom", @tips),
> -class => "rss_logo"}, "Atom") . "\n";
> } else {
> print $cgi->a({-href => href(project=>undef, action=>"opml"),
>
And perhaps we should add title attribute explaining that feed is for
given branch... or perhaps not.
--
Jakub Narebski
Poland
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-11 22:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-11 9:41 [PATCH] Advertise per branch RSS/Atom feeds Junio C Hamano
2007-08-11 19:57 ` 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).