about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-01-21 04:35:27 +0000
committerEric Wong <e@80x24.org>2017-01-21 04:35:27 +0000
commitc47247dfdee80a8ad68039df7b95d3e900e31b54 (patch)
tree67d74b5086403a1775a5b3b79c8a893d2a5d2c3b
parenta2bfef2dd80cdbd434f01fe5f7182a9a36c1b905 (diff)
downloadpublic-inbox-c47247dfdee80a8ad68039df7b95d3e900e31b54.tar.gz
This should make the code somewhat easier-to-follow.
-rw-r--r--lib/PublicInbox/RepobrowseGitAtom.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/PublicInbox/RepobrowseGitAtom.pm b/lib/PublicInbox/RepobrowseGitAtom.pm
index 99d79869..f851ee36 100644
--- a/lib/PublicInbox/RepobrowseGitAtom.pm
+++ b/lib/PublicInbox/RepobrowseGitAtom.pm
@@ -32,8 +32,8 @@ sub repo_root_url {
         PublicInbox::Repobrowse::base_url($env) . join('/', @uri);
 }
 
-sub flush_hdr ($$) {
-        my ($dst, $hdr) = @_;
+sub flush_hdr ($$$) {
+        my ($dst, $hdr, $url) = @_;
         $$dst .= '<entry><title>';
         $$dst .= utf8_html($hdr->{'s'}); # commit subject
         $$dst .= '</title><updated>';
@@ -46,8 +46,9 @@ sub flush_hdr ($$) {
         $$dst .= strftime(DATEFMT, gmtime($hdr->{at}));
         $$dst .= '</published>';
         $$dst .= qq(<link\nrel="alternate"\ntype="text/html"\nhref=");
-        $$dst .= $hdr->{url};
+        $$dst .= $url;
         $$dst .= '/commit?id=';
+
         my $H = $hdr->{H};
         $$dst .= $H;
         $$dst .= qq("\n/><id>);
@@ -73,7 +74,7 @@ sub git_atom_sed ($$) {
         my $title = join('/', $repo_info->{repo}, @{$req->{extra}});
         $title = utf8_html("$title, branch $req->{q}->{h}");
         my $url = repo_root_url($self, $req);
-        my $hdr = $req->{hdr} = { url => $url };
+        my $hdr = {};
         $req->{axml} = qq(<?xml version="1.0"?>\n) .
                 qq(<feed\nxmlns="http://www.w3.org/2005/Atom">) .
                 qq(<title>$title</title>) .
@@ -100,8 +101,8 @@ sub git_atom_sed ($$) {
                         if ($state != STATE_BODY) {
                                 $hdr->{((STATES)[$state])} = $l;
                                 if (++$state == STATE_BODY) {
-                                        flush_hdr(\$dst, $hdr);
-                                        %$hdr = (url => $url);
+                                        flush_hdr(\$dst, $hdr, $url);
+                                        $hdr = {};
                                 }
                                 next;
                         }