about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-02-14 13:17:38 +0000
committerEric Wong <e@80x24.org>2023-02-15 04:31:22 +0000
commit1d88b8639596a549dd972e113b52f9c2d035d529 (patch)
treebbce90399e49d325159d8aa71443296244eb4d67
parent771dda802ec8c13dc13a1daabcefee9f3df9bb38 (diff)
downloadpublic-inbox-1d88b8639596a549dd972e113b52f9c2d035d529.tar.gz
No need to clutter up logs when a request hits a dead branch.
-rw-r--r--lib/PublicInbox/RepoAtom.pm3
-rw-r--r--lib/PublicInbox/WwwCoderepo.pm1
-rw-r--r--t/solver_git.t5
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/PublicInbox/RepoAtom.pm b/lib/PublicInbox/RepoAtom.pm
index 44883ab4..c89d4551 100644
--- a/lib/PublicInbox/RepoAtom.pm
+++ b/lib/PublicInbox/RepoAtom.pm
@@ -120,7 +120,8 @@ sub srv_atom {
         # else: let git decide based on HEAD if $tip isn't defined
         push @cmd, '--';
         push @cmd, $path if $path ne '';
-        my $qsp = PublicInbox::Qspawn->new(\@cmd);
+        my $qsp = PublicInbox::Qspawn->new(\@cmd, undef,
+                                        { quiet => 1, 2 => $ctx->{lh} });
         $qsp->psgi_return($ctx->{env}, undef, \&atom_ok, $ctx);
 }
 
diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm
index 7a2cb80b..8a490b6c 100644
--- a/lib/PublicInbox/WwwCoderepo.pm
+++ b/lib/PublicInbox/WwwCoderepo.pm
@@ -308,6 +308,7 @@ sub srv { # endpoint called by PublicInbox::WWW
                 PublicInbox::RepoSnapshot::srv($ctx, $2) // r(404);
         } elsif ($path_info =~ m!\A/(.+?)/atom/(.*)\z! and
                         ($ctx->{git} = $cr->{$1})) {
+                $ctx->{lh} = $self->{log_fh};
                 PublicInbox::RepoAtom::srv_atom($ctx, $2) // r(404);
         } elsif ($path_info =~ m!\A/(.+?)/tags\.atom\z! and
                         ($ctx->{git} = $cr->{$1})) {
diff --git a/t/solver_git.t b/t/solver_git.t
index 0090bc06..79672398 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -379,7 +379,10 @@ EOF
                         ok($t->{feed}->{entry}, 'got entry');
 
                         $res = $cb->(GET('/public-inbox/atom/README.md'));
-                        is($res->code, 404, '404 on non-existent file Atom feed');
+                        is($res->code, 404, '404 on missing file Atom feed');
+
+                        $res = $cb->(GET('/public-inbox/atom/?h=gone'));
+                        is($res->code, 404, '404 on missing Atom feed branch');
                 }
 
                 $res = $cb->(GET('/public-inbox/tree/'));