{"thread":{"id":"43378","subject":"[PATCH 1/2] gitweb: Add an option to href() to return full URL","startedAt":"2006-11-17T11:36:18Z","lastAt":"2006-11-20T14:45:55Z","messageCount":4,"participants":["Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"297275","messageId":"200611171236.19030.jnareb@gmail.com","threadId":"43378","inReplyTo":"7v4psysazy.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Atom feeds","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-17T11:36:18Z","receivedAt":"2006-11-17T11:36:18Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Andreas Fuchs <asf@boinkor.net> writes:\n> \n>> Jakub Narebski wrote:\n>>> Andreas Fuchs <asf@boinkor.net> wrote:\n>>> \n>>>> * Wrap the commit message in <pre>\n>>> We use <div class=\"pre\"> in \"commit\" view if I remember correctly.\n>>\n>> That's ok for rendered HTML output, but in my experience, the way feed\n>> readers interpret that ranges from \"badly\" to \"not at all\"; it's better\n>> to stick to explicit structure hints only in feeds. /-:\n\nTrue. \"<pre>\" in RSS feed is better (I don't know if you can give CSS\nfor RSS, be it RSS 2.01 or Atom; rather not).\n\n>> So, this is the only thing I haven't fixed in the attached patch (:\n\nGood.\n\n>> In addition to the above points, the attached patch emits a\n>> Last-Changed: HTTP response header field, and doesn't compute the feed\n>> body if the HTTP request type was HEAD. This helps keep the web server\n>> load down for well-behaved feed readers that check if the feed needs\n>> updating.\n\nVery nice.\n\n>> Hope you like it,\n> \n> Seems sane to me.  Jakub, how do you like this one?  \n\nI like it. Ack.\n\n> If it looks  Ok to you, please arrange to include your one-liner\n> that this depends on and forward a readily applicable patch with\n> appropriate commit log message.\n\nWhich one liner? As far as I can see the patch does NOT use\nhref(-full=>1,...) but esc_url(...).\n\nPerhaps this is for next patch.\n\n\nBTW I have encountered something calles Atom Publishing Protocol (APP):\nperhaps we should also add this in addition to currently used OPML.\n-- \nJakub Narebski\nTorun, Poland\n"},{"id":"294560","messageId":"11639451221153-git-send-email-jnareb@gmail.com","threadId":"43378","inReplyTo":"200611171236.19030.jnareb@gmail.com","subject":"[PATCH 1/2] gitweb: Add an option to href() to return full URL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-19T14:05:21Z","receivedAt":"2006-11-19T14:05:21Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"href subroutine by default generates absolute URL (generated using\nCGI::url(-absolute=>1), and saved in $my_uri) using $my_uri as base;\nadd an option to generate full URL using $my_url as base.\n\nNew feature usage: href(..., -full=>1)\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 5875ba0..8739501 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -459,7 +459,8 @@ exit;\n \n sub href(%) {\n \tmy %params = @_;\n-\tmy $href = $my_uri;\n+\t# default is to use -absolute url() i.e. $my_uri\n+\tmy $href = $params{-full} ? $my_url : $my_uri;\n \n \t# XXX: Warning: If you touch this, check the search form for updating,\n \t# too.\n-- \n1.4.3.4\n"},{"id":"298484","messageId":"11639451253906-git-send-email-jnareb@gmail.com","threadId":"43378","inReplyTo":"11639451221153-git-send-email-jnareb@gmail.com","subject":"[PATCH 2/2] gitweb: Refactor feed generation, make output prettier, add Atom feed","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-19T14:05:22Z","receivedAt":"2006-11-19T14:05:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Add support for more modern Atom web feed format. Both RSS and Atom\nfeeds are generated by git_feed subroutine to avoid code duplication;\ngit_rss and git_atom are thin wrappers around git_feed. Add links to\nAtom feed in HTML header and in page footer (but not in OPML; we\nshould use APP, Atom Publishing Proptocol instead).\n\nAllow for feed generation for branches other than current (HEAD)\nbranch, and for generation of feeds for file or directory history.\n\nDo not use \"pre ${\\sub_returning_scalar(...)} post\" trick, but join\nstrings instead: \"pre \" . sub_returning_scalar(...) . \" post\".\nUse href(-full=>1, ...) instead of hand-crafting gitweb urls.\n\nMake output prettier:\n* Use title similar to the title of web page\n* Use project description (if exists) for description/subtitle\n* Do not add anything (committer name, commit date) to feed entry title\n* Wrap the commit message in <pre>\n* Make file names into an unordered list\n* Add links (diff, conditional blame, history) to the file list.\n\nIn addition to the above points, the attached patch emits a\nLast-Changed: HTTP response header field, and doesn't compute the feed\nbody if the HTTP request type was HEAD. This helps keep the web server\nload down for well-behaved feed readers that check if the feed needs\nupdating.\n\nIf browser (feed reader) sent Accept: header, and it prefers 'text/xml' type\nto 'application/rss+xml' (in the case of RSS feed) or 'application/atom+xml'\n(in the case of Atom feed), then use 'text/xml' as content type.\n\nBoth RSS and Atom feeds validate at http://feedvalidator.org\nand at http://validator.w3.org/feed/\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\nSigned-off-by: Andreas Fuchs <asf@boinkor.net>\n---\nCompared to implementation by Andreas Fuchs (antifuchs on #git) in\n  Message-ID: <ejim5q$31b$1@sea.gmane.org>\n  http://permalink.gmane.org/gmane.comp.version-control.git/31624\nthis consolidates generation of RSS and Atom feeds, cleans up feed\ngeneration code, and uses 'text/xml' as content type if browser prefers\nthis (for Mozilla).\n\nThis requires:\n \"gitweb: Add an option to href() to return full URL\"\n(sent just in case before this one), which is last patch in my previous\ngitweb patches series.\n\nThis patch DOES NOT add feed links for branches (in \"heads\" view), nor\nfeed links for files (as alternate representation of \"history\" view).\nNeither it adds Atom links to \"OPML\" view (we should use APP for that,\nI think).\n\n gitweb/gitweb.perl |  255 ++++++++++++++++++++++++++++++++++++++++++---------\n 1 files changed, 210 insertions(+), 45 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 8739501..a32a6b7 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -425,6 +425,7 @@ my %actions = (\n \t\"history\" => \\&git_history,\n \t\"log\" => \\&git_log,\n \t\"rss\" => \\&git_rss,\n+\t\"atom\" => \\&git_atom,\n \t\"search\" => \\&git_search,\n \t\"search_help\" => \\&git_search_help,\n \t\"shortlog\" => \\&git_shortlog,\n@@ -1198,10 +1199,12 @@ sub parse_date {\n \t$date{'mday'} = $mday;\n \t$date{'day'} = $days[$wday];\n \t$date{'month'} = $months[$mon];\n-\t$date{'rfc2822'} = sprintf \"%s, %d %s %4d %02d:%02d:%02d +0000\",\n-\t                   $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;\n+\t$date{'rfc2822'}   = sprintf \"%s, %d %s %4d %02d:%02d:%02d +0000\",\n+\t                     $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;\n \t$date{'mday-time'} = sprintf \"%d %s %02d:%02d\",\n \t                     $mday, $months[$mon], $hour ,$min;\n+\t$date{'iso-8601'}  = sprintf \"%04d-%02d-%02dT%02d:%02d:%02dZ\",\n+\t                     1900+$year, $mon, $mday, $hour ,$min, $sec;\n \n \t$tz =~ m/^([+\\-][0-9][0-9])([0-9][0-9])$/;\n \tmy $local = $epoch + ((int $1 + ($2/60)) * 3600);\n@@ -1209,9 +1212,9 @@ sub parse_date {\n \t$date{'hour_local'} = $hour;\n \t$date{'minute_local'} = $min;\n \t$date{'tz_local'} = $tz;\n-\t$date{'iso-tz'} = sprintf (\"%04d-%02d-%02d %02d:%02d:%02d %s\",\n-\t\t\t\t   1900+$year, $mon+1, $mday,\n-\t\t\t\t   $hour, $min, $sec, $tz);\n+\t$date{'iso-tz'} = sprintf(\"%04d-%02d-%02d %02d:%02d:%02d %s\",\n+\t                          1900+$year, $mon+1, $mday,\n+\t                          $hour, $min, $sec, $tz);\n \treturn %date;\n }\n \n@@ -1672,14 +1675,17 @@ EOF\n \t\t}\n \t}\n \tif (defined $project) {\n-\t\tprintf('<link rel=\"alternate\" title=\"%s log\" '.\n-\t\t       'href=\"%s\" type=\"application/rss+xml\"/>'.\"\\n\",\n+\t\tprintf('<link rel=\"alternate\" title=\"%s log RSS feed\" '.\n+\t\t       'href=\"%s\" type=\"application/rss+xml\" />'.\"\\n\",\n \t\t       esc_param($project), href(action=>\"rss\"));\n+\t\tprintf('<link rel=\"alternate\" title=\"%s log Atom feed\" '.\n+\t\t       'href=\"%s\" type=\"application/atom+xml\" />'.\"\\n\",\n+\t\t       esc_param($project), href(action=>\"atom\"));\n \t} else {\n \t\tprintf('<link rel=\"alternate\" title=\"%s projects list\" '.\n \t\t       'href=\"%s\" type=\"text/plain; charset=utf-8\"/>'.\"\\n\",\n \t\t       $site_name, href(project=>undef, action=>\"project_index\"));\n-\t\tprintf('<link rel=\"alternate\" title=\"%s projects logs\" '.\n+\t\tprintf('<link rel=\"alternate\" title=\"%s projects feeds\" '.\n \t\t       'href=\"%s\" type=\"text/x-opml\"/>'.\"\\n\",\n \t\t       $site_name, href(project=>undef, action=>\"opml\"));\n \t}\n@@ -1745,7 +1751,9 @@ sub git_footer_html {\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\t              -class => \"rss_logo\"}, \"RSS\") . \"\\n\";\n+\t\t              -class => \"rss_logo\"}, \"RSS\") . \" \";\n+\t\tprint $cgi->a({-href => href(action=>\"atom\"),\n+\t\t              -class => \"rss_logo\"}, \"Atom\") . \"\\n\";\n \t} else {\n \t\tprint $cgi->a({-href => href(project=>undef, action=>\"opml\"),\n \t\t              -class => \"rss_logo\"}, \"OPML\") . \" \";\n@@ -4150,26 +4158,125 @@ sub git_shortlog {\n }\n \n ## ......................................................................\n-## feeds (RSS, OPML)\n+## feeds (RSS, Atom; OPML)\n \n-sub git_rss {\n-\t# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ\n+sub git_feed {\n+\tmy $format = shift || 'atom';\n+\tmy ($have_blame) = gitweb_check_feature('blame');\n+\n+\t# Atom: http://www.atomenabled.org/developers/syndication/\n+\t# RSS:  http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ\n+\tif ($format ne 'rss' && $format ne 'atom') {\n+\t\tdie_error(undef, \"Unknown web feed format\");\n+\t}\n+\n+\t# log/feed of current (HEAD) branch, log of given branch, history of file/directory\n+\tmy $head = $hash || 'HEAD';\n \topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--max-count=150\",\n-\t\tgit_get_head_hash($project), \"--\"\n+\t\t$head, \"--\", (defined $file_name ? $file_name : ())\n \t\tor die_error(undef, \"Open git-rev-list failed\");\n \tmy @revlist = map { chomp; $_ } <$fd>;\n \tclose $fd or die_error(undef, \"Reading git-rev-list failed\");\n-\tprint $cgi->header(-type => 'text/xml', -charset => 'utf-8');\n-\tprint <<XML;\n-<?xml version=\"1.0\" encoding=\"utf-8\"?>\n+\n+\tmy %latest_commit;\n+\tmy %latest_date;\n+\tmy $content_type = \"application/$format+xml\";\n+\tif (defined $cgi->http('HTTP_ACCEPT') &&\n+\t\t $cgi->Accept('text/xml') > $cgi->Accept($content_type)) {\n+\t\t# browser (feed reader) prefers text/xml\n+\t\t$content_type = 'text/xml';\n+\t}\n+\tif (defined($revlist[0])) {\n+\t\t%latest_commit = parse_commit($revlist[0]);\n+\t\t%latest_date   = parse_date($latest_commit{'committer_epoch'});\n+\t\tprint $cgi->header(\n+\t\t\t-type => $content_type,\n+\t\t\t-charset => 'utf-8',\n+\t\t\t-last_modified => $latest_date{'rfc2822'});\n+\t} else {\n+\t\tprint $cgi->header(\n+\t\t\t-type => $content_type,\n+\t\t\t-charset => 'utf-8');\n+\t}\n+\n+\t# Optimization: skip generating the body if client asks only\n+\t# for Last-Modified date.\n+\treturn if ($cgi->request_method() eq 'HEAD');\n+\n+\t# header variables\n+\tmy $title = \"$site_name - $project/$action\";\n+\tmy $feed_type = 'log';\n+\tif (defined $hash) {\n+\t\t$title .= \" - '$hash'\";\n+\t\t$feed_type = 'branch log';\n+\t\tif (defined $file_name) {\n+\t\t\t$title .= \" :: $file_name\";\n+\t\t\t$feed_type = 'history';\n+\t\t}\n+\t} elsif (defined $file_name) {\n+\t\t$title .= \" - $file_name\";\n+\t\t$feed_type = 'history';\n+\t}\n+\t$title .= \" $feed_type\";\n+\tmy $descr = git_get_project_description($project);\n+\tif (defined $descr) {\n+\t\t$descr = esc_html($descr);\n+\t} else {\n+\t\t$descr = \"$project \" .\n+\t\t         ($format eq 'rss' ? 'RSS' : 'Atom') .\n+\t\t         \" feed\";\n+\t}\n+\tmy $owner = git_get_project_owner($project);\n+\t$owner = esc_html($owner);\n+\n+\t#header\n+\tmy $alt_url;\n+\tif (defined $file_name) {\n+\t\t$alt_url = href(-full=>1, action=>\"history\", hash=>$hash, file_name=>$file_name);\n+\t} elsif (defined $hash) {\n+\t\t$alt_url = href(-full=>1, action=>\"log\", hash=>$hash);\n+\t} else {\n+\t\t$alt_url = href(-full=>1, action=>\"summary\");\n+\t}\n+\tprint qq!<?xml version=\"1.0\" encoding=\"utf-8\"?>\\n!;\n+\tif ($format eq 'rss') {\n+\t\tprint <<XML;\n <rss version=\"2.0\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\">\n <channel>\n-<title>$project $my_uri $my_url</title>\n-<link>${\\esc_html(\"$my_url?p=$project;a=summary\")}</link>\n-<description>$project log</description>\n-<language>en</language>\n XML\n+\t\tprint \"<title>$title</title>\\n\" .\n+\t\t      \"<link>$alt_url</link>\\n\" .\n+\t\t      \"<description>$descr</description>\\n\" .\n+\t\t      \"<language>en</language>\\n\";\n+\t} elsif ($format eq 'atom') {\n+\t\tprint <<XML;\n+<feed xmlns=\"http://www.w3.org/2005/Atom\">\n+XML\n+\t\tprint \"<title>$title</title>\\n\" .\n+\t\t      \"<subtitle>$descr</subtitle>\\n\" .\n+\t\t      '<link rel=\"alternate\" type=\"text/html\" href=\"' .\n+\t\t      $alt_url . '\" />' . \"\\n\" .\n+\t\t      '<link rel=\"self\" type=\"' . $content_type . '\" href=\"' .\n+\t\t      $cgi->self_url() . '\" />' . \"\\n\" .\n+\t\t      \"<id>\" . href(-full=>1) . \"</id>\\n\" .\n+\t\t      # use project owner for feed author\n+\t\t      \"<author><name>$owner</name></author>\\n\";\n+\t\tif (defined $favicon) {\n+\t\t\tprint \"<icon>\" . esc_url($favicon) . \"</icon>\\n\";\n+\t\t}\n+\t\tif (defined $logo_url) {\n+\t\t\t# not twice as wide as tall: 72 x 27 pixels\n+\t\t\tprint \"<logo>\" . esc_url($logo_url) . \"</logo>\\n\";\n+\t\t}\n+\t\tif (! %latest_date) {\n+\t\t\t# dummy date to keep the feed valid until commits trickle in:\n+\t\t\tprint \"<updated>1970-01-01T00:00:00Z</updated>\\n\";\n+\t\t} else {\n+\t\t\tprint \"<updated>$latest_date{'iso-8601'}</updated>\\n\";\n+\t\t}\n+\t}\n \n+\t# contents\n \tfor (my $i = 0; $i <= $#revlist; $i++) {\n \t\tmy $commit = $revlist[$i];\n \t\tmy %co = parse_commit($commit);\n@@ -4178,42 +4285,100 @@ XML\n \t\t\tlast;\n \t\t}\n \t\tmy %cd = parse_date($co{'committer_epoch'});\n+\n+\t\t# get list of changed files\n \t\topen $fd, \"-|\", git_cmd(), \"diff-tree\", '-r', @diff_opts,\n-\t\t\t$co{'parent'}, $co{'id'}, \"--\"\n+\t\t\t$co{'parent'}, $co{'id'}, \"--\", (defined $file_name ? $file_name : ())\n \t\t\tor next;\n \t\tmy @difftree = map { chomp; $_ } <$fd>;\n \t\tclose $fd\n \t\t\tor next;\n-\t\tprint \"<item>\\n\" .\n-\t\t      \"<title>\" .\n-\t\t      sprintf(\"%d %s %02d:%02d\", $cd{'mday'}, $cd{'month'}, $cd{'hour'}, $cd{'minute'}) . \" - \" . esc_html($co{'title'}) .\n-\t\t      \"</title>\\n\" .\n-\t\t      \"<author>\" . esc_html($co{'author'}) . \"</author>\\n\" .\n-\t\t      \"<pubDate>$cd{'rfc2822'}</pubDate>\\n\" .\n-\t\t      \"<guid isPermaLink=\\\"true\\\">\" . esc_html(\"$my_url?p=$project;a=commit;h=$commit\") . \"</guid>\\n\" .\n-\t\t      \"<link>\" . esc_html(\"$my_url?p=$project;a=commit;h=$commit\") . \"</link>\\n\" .\n-\t\t      \"<description>\" . esc_html($co{'title'}) . \"</description>\\n\" .\n-\t\t      \"<content:encoded>\" .\n-\t\t      \"<![CDATA[\\n\";\n+\n+\t\t# print element (entry, item)\n+\t\tmy $co_url = href(-full=>1, action=>\"commit\", hash=>$commit);\n+\t\tif ($format eq 'rss') {\n+\t\t\tprint \"<item>\\n\" .\n+\t\t\t      \"<title>\" . esc_html($co{'title'}) . \"</title>\\n\" .\n+\t\t\t      \"<author>\" . esc_html($co{'author'}) . \"</author>\\n\" .\n+\t\t\t      \"<pubDate>$cd{'rfc2822'}</pubDate>\\n\" .\n+\t\t\t      \"<guid isPermaLink=\\\"true\\\">$co_url</guid>\\n\" .\n+\t\t\t      \"<link>$co_url</link>\\n\" .\n+\t\t\t      \"<description>\" . esc_html($co{'title'}) . \"</description>\\n\" .\n+\t\t\t      \"<content:encoded>\" .\n+\t\t\t      \"<![CDATA[\\n\";\n+\t\t} elsif ($format eq 'atom') {\n+\t\t\tprint \"<entry>\\n\" .\n+\t\t\t      \"<title type=\\\"html\\\">\" . esc_html($co{'title'}) . \"</title>\\n\" .\n+\t\t\t      \"<updated>$cd{'iso-8601'}</updated>\\n\" .\n+\t\t\t      \"<author><name>\" . esc_html($co{'author_name'}) . \"</name></author>\\n\" .\n+\t\t\t      # use committer for contributor\n+\t\t\t      \"<contributor><name>\" . esc_html($co{'committer_name'}) . \"</name></contributor>\\n\" .\n+\t\t\t      \"<published>$cd{'iso-8601'}</published>\\n\" .\n+\t\t\t      \"<link rel=\\\"alternate\\\" type=\\\"text/html\\\" href=\\\"$co_url\\\" />\\n\" .\n+\t\t\t      \"<id>$co_url</id>\\n\" .\n+\t\t\t      \"<content type=\\\"xhtml\\\" xml:base=\\\"\" . esc_url($my_url) . \"\\\">\\n\" .\n+\t\t\t      \"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">\\n\";\n+\t\t}\n \t\tmy $comment = $co{'comment'};\n+\t\tprint \"<pre>\\n\";\n \t\tforeach my $line (@$comment) {\n-\t\t\t$line = to_utf8($line);\n-\t\t\tprint \"$line<br/>\\n\";\n+\t\t\t$line = esc_html($line);\n+\t\t\tprint \"$line\\n\";\n \t\t}\n-\t\tprint \"<br/>\\n\";\n-\t\tforeach my $line (@difftree) {\n-\t\t\tif (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\\t(.*)$/)) {\n-\t\t\t\tnext;\n+\t\tprint \"</pre><ul>\\n\";\n+\t\tforeach my $difftree_line (@difftree) {\n+\t\t\tmy %difftree = parse_difftree_raw_line($difftree_line);\n+\t\t\tnext if !$difftree{'from_id'};\n+\n+\t\t\tmy $file = $difftree{'file'} || $difftree{'to_file'};\n+\n+\t\t\tprint \"<li>\" .\n+\t\t\t      \"[\" .\n+\t\t\t      $cgi->a({-href => href(-full=>1, action=>\"blobdiff\",\n+\t\t\t                             hash=>$difftree{'to_id'}, hash_parent=>$difftree{'from_id'},\n+\t\t\t                             hash_base=>$co{'id'}, hash_parent_base=>$co{'parent'},\n+\t\t\t                             file_name=>$file, file_parent=>$difftree{'from_file'}),\n+\t\t\t              -title => \"diff\"}, 'D');\n+\t\t\tif ($have_blame) {\n+\t\t\t\tprint $cgi->a({-href => href(-full=>1, action=>\"blame\",\n+\t\t\t\t                             file_name=>$file, hash_base=>$commit),\n+\t\t\t\t              -title => \"blame\"}, 'B');\n \t\t\t}\n-\t\t\tmy $file = esc_path(unquote($7));\n-\t\t\t$file = to_utf8($file);\n-\t\t\tprint \"$file<br/>\\n\";\n+\t\t\t# if this is not a feed of a file history\n+\t\t\tif (!defined $file_name || $file_name ne $file) {\n+\t\t\t\tprint $cgi->a({-href => href(-full=>1, action=>\"history\",\n+\t\t\t\t                             file_name=>$file, hash=>$commit),\n+\t\t\t\t              -title => \"history\"}, 'H');\n+\t\t\t}\n+\t\t\t$file = esc_path($file);\n+\t\t\tprint \"] \".\n+\t\t\t      \"$file</li>\\n\";\n+\t\t}\n+\t\tif ($format eq 'rss') {\n+\t\t\tprint \"</ul>]]>\\n\" .\n+\t\t\t      \"</content:encoded>\\n\" .\n+\t\t\t      \"</item>\\n\";\n+\t\t} elsif ($format eq 'atom') {\n+\t\t\tprint \"</ul>\\n</div>\\n\" .\n+\t\t\t      \"</content>\\n\" .\n+\t\t\t      \"</entry>\\n\";\n \t\t}\n-\t\tprint \"]]>\\n\" .\n-\t\t      \"</content:encoded>\\n\" .\n-\t\t      \"</item>\\n\";\n \t}\n-\tprint \"</channel></rss>\";\n+\n+\t# end of feed\n+\tif ($format eq 'rss') {\n+\t\tprint \"</channel>\\n</rss>\\n\";\n+\t}\telsif ($format eq 'atom') {\n+\t\tprint \"</feed>\\n\";\n+\t}\n+}\n+\n+sub git_rss {\n+\tgit_feed('rss');\n+}\n+\n+sub git_atom {\n+\tgit_feed('atom');\n }\n \n sub git_opml {\n-- \n1.4.3.4\n"},{"id":"298374","messageId":"ejsf09$dej$1@sea.gmane.org","threadId":"43378","inReplyTo":"11639451253906-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 2/2] gitweb: Refactor feed generation, make output prettier, add Atom feed","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-20T14:45:55Z","receivedAt":"2006-11-20T14:45:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Jakub Narebski wrote:\n\n> Allow for feed generation for branches other than current (HEAD)\n> branch, and for generation of feeds for file or directory history.\n\nBy the way, which feed format use for branch feeds? Atom or RSS?\nOr perhaps leave this configurable? But which way:\n  our $default_feed_format = 'atom';\nor use 'feedformat' feature?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"}]}