From a3ef996f04db6a46e41575ca5a0442cdd709e485 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 4 Nov 2026 21:45:26 -1000 Subject: Answer an empty repository's feed with a feed --- tests/t0111-atom.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/t0111-atom.sh b/tests/t0111-atom.sh index 608ab78..3040b79 100755 --- a/tests/t0111-atom.sh +++ b/tests/t0111-atom.sh @@ -63,4 +63,23 @@ test_expect_success 'the feed link encodes the repository and the branch' ' grep "title=.Atom feed. href=.http://example.org/foo%2Bbar/atom/?h=1%2B2." tmp ' +# A reader may subscribe before the first push, and the page every other view +# of an empty repository falls back to is no feed it can read. +test_expect_success 'an empty repository answers with a feed of no entries' ' + git init -q --bare repos/empty.git && + cgitrc_repo emptyrc empty "repo.path=$PWD/repos/empty.git" && + cgit_rc emptyrc "url=empty/atom" >tmp && + head -n 1 tmp | grep "Status: 200 OK" && + sed "/^$/q" tmp | grep "Content-Type: application/atom+xml" && + strip_headers feed && + grep "empty" feed && + grep "" feed && + ! grep "" feed && + grep "" feed +' + +test_expect_success XMLLINT 'the empty feed is well-formed xml' ' + xmllint --noout feed +' + test_done -- cgit 2.12.1