From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C169B1F628 for ; Tue, 14 Feb 2023 13:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1676380659; bh=Ir/lLwsPTzUvyWaNpiUu6hkInppWyvCOhFW/QLB1BIo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z6lWJUmliXlh70eJTo1tusBbuXwgi+t3RuBQLFYrx01iVY+9RH8BgLo2QuUfXkhx1 0nE3NyDPkPPZU5XD7bw/gH9x05GoybsT3jrbb9ZhPuio5AhOwRxm1aRNVH/z+v046K R1DJMrQwVBoaWGXndJ55nq6PicOTgyUSispFil9s= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] www_coderepo: quiet 404s on Atom feeds for dead branches Date: Tue, 14 Feb 2023 13:17:38 +0000 Message-Id: <20230214131739.2978030-2-e@80x24.org> In-Reply-To: <20230214131739.2978030-1-e@80x24.org> References: <20230214131739.2978030-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: No need to clutter up logs when a request hits a dead branch. --- lib/PublicInbox/RepoAtom.pm | 3 ++- lib/PublicInbox/WwwCoderepo.pm | 1 + t/solver_git.t | 5 ++++- 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/'));