From cb812960c410401bc6f5bab27c9f1463ef14d7e8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 16:37:32 -1000 Subject: Name what a missing parent really does to the log The log walks the history before it prints a row, so nothing ahead of the gap ever renders and the title promised more than the page shows. The test also took its gap from the shared repository, where HEAD~2 was a given commit only because of tests run before it. --- tests/t0303-robustness.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index 9ae0347..34c0f22 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -430,19 +430,25 @@ test_expect_success 'a die inside git answers one 500 page and logs the reason' ! grep "bad config line" tmp ' -test_expect_success 'a history with a missing parent renders up to the gap' ' - git clone -q repos/rob gap && - older=$(git -C gap rev-parse HEAD~3) && - parent=$(git -C gap rev-parse HEAD~2) && - rm gap/.git/objects/$(echo $parent | cut -c1-2)/$(echo $parent | cut -c3-) && +# The log walks the history before it prints a row, so a missing commit ends +# the page before any of it, and the reason goes to the log alone. +test_expect_success 'a history with a missing parent answers one error' ' + test_create_repo gap && + test_commit -C gap --no-tag first && + test_commit -C gap --no-tag second && + test_commit -C gap --no-tag third && + older=$(git -C gap rev-parse HEAD~2) && + parent=$(git -C gap rev-parse HEAD~1) && + tip=$(git -C gap rev-parse HEAD) && + rm "gap/.git/objects/$(test_oid_to_path $parent)" && cgitrc_repo gaprc gap "repo.path=$PWD/gap/.git" && cgit_rc gaprc "url=gap/log/" >tmp 2>err && test $(grep -c "^Status:" tmp) = 1 && - grep "Unable to complete the request" tmp && - grep "Failed to traverse parents" err && + test_grep "
Unable to complete the request
" tmp && + test_grep "Failed to traverse parents of commit $tip" err && cgit_rc gaprc "url=gap/patch/&id2=$older" >tmp && test $(grep -c "^Status:" tmp) = 1 && - grep "^Status: 500" tmp + test_grep "^Status: 500" tmp ' # The commit page collects each file's diff body before printing it, so a -- cgit 2.12.1